diff options
author | Julio B <julio.bacel@gmail.com> | 2024-04-14 01:27:44 +0300 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-04-14 11:51:04 +0200 |
commit | 0a1af14fd91640cc19f7e06d7fd70b9424b459cc (patch) | |
tree | 09c2556db79fb41bd6443acf96fce487991f70ee | |
parent | 805a29aef9320545ec113208df5a04e454ac7fb8 (diff) | |
download | aerc-0a1af14fd91640cc19f7e06d7fd70b9424b459cc.tar.gz |
notmuch: fix disappearing messages
The current implementation assumes that 'root[0].FirstChild' is nil, but
this is not always the case. Instead of overwriting the FirstChild,
detect and link the messages to the LastChild of root[0].
Fixes: 672b4edca7af ("notmuch: draw incomplete threads")
Signed-off-by: Julio B <julio.bacel@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | worker/notmuch/lib/database.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index 7216274a..9a8a9a60 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -139,7 +139,10 @@ func (db *DB) ThreadsFromQuery(ctx context.Context, q string, entireThread bool) root := db.makeThread(nil, &tlm, entireThread) if len(root) > 1 { root[0].Dummy = true - root[0].FirstChild = root[0].NextSibling + fc := &(root[0].FirstChild) + for ; *fc != nil; fc = &((*fc).NextSibling) { + } + *fc = root[0].NextSibling root[0].NextSibling.PrevSibling = nil root[0].NextSibling = nil for i := 1; i < len(root); i++ { |