diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msgstore.go | 13 | ||||
-rw-r--r-- | lib/threadbuilder.go | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go index c68c2ed8..ca5f16d9 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -517,14 +517,23 @@ func (store *MessageStore) Unfold(uid uint32) error { return store.doThreadFolding(uid, false) } -func (store *MessageStore) doThreadFolding(uid uint32, hidden bool) error { +func (store *MessageStore) doThreadFolding(uid uint32, hide bool) error { thread, err := store.Thread(uid) if err != nil { return err } + if hide && thread.FirstChild.Hidden > 0 { + return nil + } err = thread.Walk(func(t *types.Thread, _ int, __ error) error { if t.Uid != uid { - t.Hidden = hidden + if hide { + t.Hidden++ //increase fold level + } else if t.Hidden > 1 { + t.Hidden-- + } else { + t.Hidden = 0 + } } return nil }) diff --git a/lib/threadbuilder.go b/lib/threadbuilder.go index 1f2d72c6..63ae80d3 100644 --- a/lib/threadbuilder.go +++ b/lib/threadbuilder.go @@ -205,7 +205,7 @@ func (builder *ThreadBuilder) RebuildUids(threads []*types.Thread, inverse bool) t.Deleted = stored.Deleted } builder.threadMap[t.Uid] = t - if t.Deleted || t.Hidden { + if t.Deleted || t.Hidden != 0 { return nil } threaduids = append(threaduids, t.Uid) |