melib/imap: fix set unseen updating all mboxes

When manually setting an envelope as not seen, all mailboxes had their
unseen count increased. This commit updates only those that include the
envelope in the first place.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/337/head
Manos Pitsidianakis 2024-01-01 14:34:50 +02:00
parent 31401fa35c
commit e3351d2755
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 2 additions and 2 deletions

View File

@ -849,8 +849,8 @@ impl MailBackend for ImapType {
.await?;
if set_unseen {
for f in uid_store.mailboxes.lock().await.values() {
if let Ok(mut unseen) = f.unseen.lock() {
for env_hash in env_hashes.iter() {
if let (Ok(mut unseen), Ok(exists)) = (f.unseen.lock(), f.exists.lock()) {
for env_hash in env_hashes.iter().filter(|h| exists.contains(h)) {
unseen.insert_new(env_hash);
}
};