diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-06-29 13:34:54 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-07-02 18:24:41 +0200 |
commit | e2be2dd4c0a9e2e5b00682a7e4236dfcd4a01fc4 (patch) | |
tree | c7aae2896238117cfd45f3144c2d4b02904fcc76 /worker/notmuch/lib/database.go | |
parent | c04446327ef24410e6a98eb670674e2b8caabcde (diff) | |
download | aerc-e2be2dd4c0a9e2e5b00682a7e4236dfcd4a01fc4.zip |
notmuch: fix server-side threads
Notmuch server-side threading added messages within a thread that didn't
match the query into the uidstore. By doing so, several UI issues
presented:
* All "hidden" messages displayed at the bottom of the msglist
* Selected messages wouldn't open properly
This patch stops these messages from being put into the message store,
thereby resolving the UI issues
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'worker/notmuch/lib/database.go')
-rw-r--r-- | worker/notmuch/lib/database.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index 46a39bc..670130f 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -301,6 +301,20 @@ func (db *DB) makeThread(parent *types.Thread, msgs *notmuch.Messages, for msgs.Next(&msg) { msgID := msg.ID() _, inQuery := valid[msgID] + var noReplies bool + replies, err := msg.Replies() + // Replies() returns an error if there are no replies + if err != nil { + noReplies = true + } + if !inQuery { + if noReplies { + continue + } + defer replies.Close() + parent = db.makeThread(parent, replies, valid) + continue + } node := &types.Thread{ Uid: db.uidStore.GetOrInsert(msgID), Parent: parent, @@ -318,9 +332,7 @@ func (db *DB) makeThread(parent *types.Thread, msgs *notmuch.Messages, lastSibling.NextSibling = node } lastSibling = node - replies, err := msg.Replies() - if err != nil { - // if there are no replies it will return an error + if noReplies { continue } defer replies.Close() |