diff options
Diffstat (limited to 'worker')
-rw-r--r-- | worker/notmuch/lib/database.go | 16 |
1 files 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() } |