Clear tags before applying new ones in NewFlags

memfd
Manos Pitsidianakis 2020-06-09 15:39:01 +03:00
parent ca9d4fde58
commit 1241b6073f
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 4 additions and 6 deletions

View File

@ -508,12 +508,10 @@ impl Account {
RefreshEventKind::NewFlags(env_hash, (flags, tags)) => { RefreshEventKind::NewFlags(env_hash, (flags, tags)) => {
let mut envelopes = self.collection.envelopes.write().unwrap(); let mut envelopes = self.collection.envelopes.write().unwrap();
envelopes.entry(env_hash).and_modify(|entry| { envelopes.entry(env_hash).and_modify(|entry| {
for f in tags { entry.labels_mut().clear();
let hash = tag_hash!(f); entry
if !entry.labels().contains(&hash) { .labels_mut()
entry.labels_mut().push(hash); .extend(tags.into_iter().map(|h| tag_hash!(h)));
}
}
entry.set_flags(flags); entry.set_flags(flags);
}); });
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]