widgets/dirlist: Fix total message count

This fixes an issue with the updated count logic, where only fetched messages
where counted to the exists string of the rue count.

Note that the count is still broken (we only count read / unread messages we
fetched, but that is the same behaviour as prior to the commit
66b68f35b3)
This commit is contained in:
Reto Brunner 2020-02-24 20:12:16 +01:00 committed by Drew DeVault
parent 8ad517ea92
commit 53d0c0a903

View file

@ -177,7 +177,10 @@ func (dirlist *DirectoryList) getRUEString(name string) string {
totalUnseen = msgStore.DirInfo.Unseen
totalExists = msgStore.DirInfo.Exists
} else {
totalRecent, totalUnseen, totalExists = countRUE(msgStore)
totalRecent, totalUnseen = countRUE(msgStore)
// use the total count from the dirinfo, else we only count already
// fetched messages
totalExists = msgStore.DirInfo.Exists
}
rueString := ""
if totalRecent > 0 {
@ -377,7 +380,7 @@ func (dirlist *DirectoryList) getSortCriteria() []*types.SortCriterion {
return criteria
}
func countRUE(msgStore *lib.MessageStore) (recent, unread, exist int) {
func countRUE(msgStore *lib.MessageStore) (recent, unread int) {
for _, msg := range msgStore.Messages {
if msg == nil {
continue
@ -398,7 +401,6 @@ func countRUE(msgStore *lib.MessageStore) (recent, unread, exist int) {
unread++
}
}
exist++
}
return recent, unread, exist
return recent, unread
}