diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-05-31 13:22:28 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-06-07 15:50:32 +0200 |
commit | 4985d1bab8996a995bd93abe120835320e3c7d82 (patch) | |
tree | fa2bf7cfa807d3595343865f431915602859386a /widgets | |
parent | 2551dd1bfa2c68a6ba8644a0c45b24fce8874674 (diff) | |
download | aerc-4985d1bab8996a995bd93abe120835320e3c7d82.tar.gz |
fix: rue string count accuracy
The countRUE function was inaccurately counting flags. If a message was
unread and recent, it was only counted as recent. The two flags are not
mutually exclusive. A previous count for a mailbox with 1 recent, 1
unread, and 5 existing would be :
1/0/5
An accurate count of this state would be:
1/1/5
This patch fixes the count.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/dirlist.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go index ca0f6c19..99ffe194 100644 --- a/widgets/dirlist.go +++ b/widgets/dirlist.go @@ -522,21 +522,17 @@ func countRUE(msgStore *lib.MessageStore) (recent, unread int) { continue } seen := false - isrecent := false for _, flag := range msg.Flags { if flag == models.SeenFlag { seen = true - } else if flag == models.RecentFlag { - isrecent = true } - } - if !seen { - if isrecent { + if flag == models.RecentFlag { recent++ - } else { - unread++ } } + if !seen { + unread++ + } } return recent, unread } |