From 672b4edca7af2303cfcb1d69a676556d12476b5f Mon Sep 17 00:00:00 2001 From: Julio B Date: Wed, 6 Mar 2024 01:11:04 +0200 Subject: notmuch: draw incomplete threads Create a "pseudo thread" with the first message as root. This is a temporary solution, until we have a more generic implementation of dummy messages that works for all backends. Signed-off-by: Julio B Tested-by: Inwit Acked-by: Robin Jarry --- worker/notmuch/lib/database.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index 9e66b2ae..bd0bc639 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -137,11 +137,17 @@ func (db *DB) ThreadsFromQuery(ctx context.Context, q string, entireThread bool) thread := threads.Thread() tlm := thread.TopLevelMessages() root := db.makeThread(nil, &tlm, entireThread) - // if len(root) > 1 { - // TODO make a dummy root node and link all the - // first level children to it - // } - res = append(res, root...) + if len(root) > 1 { + root[0].FirstChild = root[0].NextSibling + root[0].NextSibling.PrevSibling = nil + root[0].NextSibling = nil + for i := 1; i < len(root); i++ { + root[i].Parent = root[0] + } + res = append(res, root[0]) + } else { + res = append(res, root...) + } tlm.Close() thread.Close() } -- cgit v1.2.3-54-g00ecf