diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-08-12 23:49:25 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-08-12 23:49:36 +0300 |
commit | f48642e260e7cc733b619e34e47d6e67b484fee0 (patch) | |
tree | eee1bd967aa685aada52488d00a260d25313d889 /app/models/discussion.rb | |
parent | 33edde50ab9a1f218ee4a5c9d2493a3d49d9b359 (diff) |
Add specs for Discussion and MergeRequest models
Diffstat (limited to 'app/models/discussion.rb')
-rw-r--r-- | app/models/discussion.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/discussion.rb b/app/models/discussion.rb index c1fd012a27d..09d4596094e 100644 --- a/app/models/discussion.rb +++ b/app/models/discussion.rb @@ -83,9 +83,7 @@ class Discussion end def to_be_resolved? - return @to_be_resolved if defined?(@to_be_resolved) - - @to_be_resolved = notes.any?(&:to_be_resolved?) + resolvable? && !resolved? end def can_resolve?(current_user) @@ -97,12 +95,16 @@ class Discussion end def resolve!(current_user) + return unless resolvable? + notes.each do |note| note.resolve!(current_user) if note.resolvable? end end def unresolve! + return unless resolvable? + notes.each do |note| note.unresolve! if note.resolvable? end |