aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/lib/database.go
diff options
context:
space:
mode:
authorMichael Adler <michael.adler.oss@mailbox.org>2024-10-16 09:18:38 +0200
committerTim Culverhouse <tim@timculverhouse.com>2024-10-16 19:52:49 -0500
commit8060cbe70b0068928629a9b7263768d067766878 (patch)
treea3e22c7df5050b2ce623938643ab3081d4d09c0b /worker/notmuch/lib/database.go
parentd13361b8dbaeba9b900108b26b56bf56fce9be26 (diff)
downloadaerc-8060cbe70b0068928629a9b7263768d067766878.tar.gz
notmuch: fix explicit searches for excluded tags
Ensure that search queries containing tags from exclude-tags actually return messages by treating STATUS_IGNORED as an informational message rather than an error. For example, this covers the use-case where spam messages are ignored by default (exclude-tags = spam) and having a dedicated qmap entry allowing review of the possible spam messages: spam = tag:spam. Changelog-fixed: Notmuch searches which explicitly contain tags from `exclude-tags` now return messages. Signed-off-by: Michael Adler <michael.adler.oss@mailbox.org> Tested-by: Jason Cox <me@jasoncarloscox.com>
Diffstat (limited to 'worker/notmuch/lib/database.go')
-rw-r--r--worker/notmuch/lib/database.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go
index 2915605d..b4643a56 100644
--- a/worker/notmuch/lib/database.go
+++ b/worker/notmuch/lib/database.go
@@ -68,7 +68,9 @@ func (db *DB) newQuery(query string) (*notmuch.Query, error) {
q.Sort(notmuch.SORT_OLDEST_FIRST)
for _, t := range db.excludedTags {
err := q.ExcludeTag(t)
- if err != nil {
+ // do not treat STATUS_IGNORED as an error; this allows explicit
+ // searches using tags that are excluded by default
+ if err != nil && !errors.Is(err, notmuch.STATUS_IGNORED) {
return nil, err
}
}