-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message sort order when using maildir as storage. #124
Comments
That'd be a bug, of sorts. The maildir implementation returns messages in the order they're returned by the file system without any sorting. Having just looked at the code, its even more basic than that - it returns all messages regardless of the start or limit values passed in. Adding a sort would be easy, though inefficient for large numbers of messages (not that what's there now could be considered efficient). Start and limit would be a bit tougher, so |
we also experience this problem with the maildir-based storage |
The `maildir` backend sorts mails in the UI in the wrong order (old > new) instead of the other way round. See also: - mailhog/MailHog#124
Just something as simple as: sort.Slice(n, func(i, j int) bool {
return !n[i].ModTime().Before(n[j].ModTime())
})
if start < 0 {
start = 0
}
if len(n) < start+limit {
limit = len(n) - start
}
if len(n) > start && start > 0 {
n = n[start:]
}
if len(n) > limit {
n = n[:limit]
} in the storage/maildir.go would add date sorting by default and start/limit support, the overhead isn't that much more than what it currently has. |
When using maildir as my storage medium, all messages are sorted ascending, how can I get them to sort descending(most recent first)?
The text was updated successfully, but these errors were encountered: