diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-08-04 01:32:00 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-08-04 01:32:00 +0300 |
commit | 538e66d71c0f7125cc62ea51480668ba8b342544 (patch) | |
tree | d27f667dbe404ce406e2ac6b3a901b87ff93da47 /app/models/discussion.rb | |
parent | 3ccb27c0c79ef92585a901de32339948319cf068 (diff) | |
parent | 8890376f0f72f713a7530bd7989e71442c69dc91 (diff) |
Merge branch 'master' into diff-line-comment-vuejs
# Conflicts:
# app/models/discussion.rb
# db/schema.rb
Diffstat (limited to 'app/models/discussion.rb')
-rw-r--r-- | app/models/discussion.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/models/discussion.rb b/app/models/discussion.rb index 88de62d19e0..c1fd012a27d 100644 --- a/app/models/discussion.rb +++ b/app/models/discussion.rb @@ -67,11 +67,15 @@ class Discussion end def resolvable? - diff_discussion? && notes.any?(&:resolvable?) + return @resolvable if defined?(@resolvable) + + @resolvable = diff_discussion? && notes.any?(&:resolvable?) end def resolved? - resolvable? && notes.none?(&:to_be_resolved?) + return @resolved if defined?(@resolved) + + @resolved = resolvable? && notes.none?(&:to_be_resolved?) end def resolved_notes @@ -79,7 +83,9 @@ class Discussion end def to_be_resolved? - notes.any?(&:to_be_resolved?) + return @to_be_resolved if defined?(@to_be_resolved) + + @to_be_resolved = notes.any?(&:to_be_resolved?) end def can_resolve?(current_user) @@ -106,6 +112,12 @@ class Discussion self.noteable == target && !diff_discussion? end + def active? + return @active if defined?(@active) + + @active = first_note.active? + end + def collapsed? return false unless diff_discussion? |