mirror of
https://git.sr.ht/~rjarry/aerc
synced 2026-10-27 10:15:05 +01:00
The notmuch worker applies flag and tag changes to the database but never tells the UI about them. The message store keeps the MessageInfo it cached when the message was first listed, so a message that has just been read keeps its unread styling and a message that has just been tagged keeps its old labels, until aerc is restarted. Re-opening the folder does not help either, since the cache is keyed by uid and survives a new query. Post the updated MessageInfo from handleFlagMessages() and handleModifyLabels(), as the imap worker already does. ReplaceFlags is set when reporting flags so that clearing one works: the store ORs flags together otherwise, which would make setting a flag work while clearing it silently did nothing. Changing tags can also take a message out of the current query. Adding one listed in exclude-tags is the obvious case, but removing a tag the query selects on does it just as well, and folder queries are arbitrary notmuch queries. Testing only the added tags against exclude-tags would therefore miss removals, so after modifying tags the folder query is re-run restricted to the affected messages and MessagesDeleted is posted for those that no longer match. The query is batched so that tagging a large selection stays a handful of queries rather than one per message. Changelog-fixed: Messages in the `notmuch` backend now update immediately when they are read or when their tags change, instead of keeping their previous appearance until aerc is restarted. Signed-off-by: Jérémy Pagé <contact@jeremypage.me> Acked-by: Simon Martin <simon@nasilyan.com> Tested-by: Inwit <inwit@sindominio.net>