aboutsummaryrefslogtreecommitdiffstats
path: root/lib/msgstore.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/msgstore.go')
-rw-r--r--lib/msgstore.go13
1 files changed, 11 insertions, 2 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
})