From 1241b6073fcc0991a015a560bda7a179d5000394 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 9 Jun 2020 15:39:01 +0300 Subject: [PATCH] Clear tags before applying new ones in NewFlags --- src/conf/accounts.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/conf/accounts.rs b/src/conf/accounts.rs index a5b76053..5470f9cb 100644 --- a/src/conf/accounts.rs +++ b/src/conf/accounts.rs @@ -508,12 +508,10 @@ impl Account { RefreshEventKind::NewFlags(env_hash, (flags, tags)) => { let mut envelopes = self.collection.envelopes.write().unwrap(); envelopes.entry(env_hash).and_modify(|entry| { - for f in tags { - let hash = tag_hash!(f); - if !entry.labels().contains(&hash) { - entry.labels_mut().push(hash); - } - } + entry.labels_mut().clear(); + entry + .labels_mut() + .extend(tags.into_iter().map(|h| tag_hash!(h))); entry.set_flags(flags); }); #[cfg(feature = "sqlite3")]