diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-25 22:46:13 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-25 22:46:13 -0600 |
commit | d76d051b226893a20060c51128e1eb5bfd86fd3f (patch) | |
tree | 9993407302f8f1a327caf1d83cbe8946943febe0 /app/models/discussion.rb | |
parent | eeb41c759e246bf96bda8d8f02478860cc6448bb (diff) | |
download | gitlab-ce-d76d051b226893a20060c51128e1eb5bfd86fd3f.tar.gz |
Collapse/hide resolved discussions
Diffstat (limited to 'app/models/discussion.rb')
-rw-r--r-- | app/models/discussion.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/models/discussion.rb b/app/models/discussion.rb index cc586933112..50fa814b311 100644 --- a/app/models/discussion.rb +++ b/app/models/discussion.rb @@ -87,8 +87,20 @@ class Discussion self.noteable == target && !diff_discussion? end + def collapsed? + return false unless diff_discussion? + + if resolvable? + # New diff discussions only disappear once they are marked resolved + resolved? + else + # Old diff discussions disappear once they become outdated + !active? + end + end + def expanded? - !diff_discussion? || active? + !collapsed? end def reply_attributes |