Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-09-18 20:25:23 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-09-18 20:29:32 +0300
commit6a4ee9aa7140862075cafae1ddebd133eec52b5b (patch)
tree9890bb5c906a0d6e207149ae5fe1df84d213fa7c /app/models/concerns/resolvable_discussion.rb
parent9ae92b8caa6c11d8860f86b7d6378062215d1b72 (diff)
Allow simple ivar ||= form. Update accordingly
Diffstat (limited to 'app/models/concerns/resolvable_discussion.rb')
-rw-r--r--app/models/concerns/resolvable_discussion.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/concerns/resolvable_discussion.rb b/app/models/concerns/resolvable_discussion.rb
index 09bb2823ab9..56ba4a9a4d0 100644
--- a/app/models/concerns/resolvable_discussion.rb
+++ b/app/models/concerns/resolvable_discussion.rb
@@ -1,4 +1,3 @@
-# rubocop:disable Cop/ModuleWithInstanceVariables
module ResolvableDiscussion
extend ActiveSupport::Concern
@@ -31,12 +30,14 @@ module ResolvableDiscussion
allow_nil: true
end
+ # rubocop:disable Cop/ModuleWithInstanceVariables
def resolvable?
return @resolvable if @resolvable.present?
@resolvable = potentially_resolvable? && notes.any?(&:resolvable?)
end
+ # rubocop:disable Cop/ModuleWithInstanceVariables
def resolved?
return @resolved if @resolved.present?
@@ -47,12 +48,14 @@ module ResolvableDiscussion
@first_note ||= notes.first
end
+ # rubocop:disable Cop/ModuleWithInstanceVariables
def first_note_to_resolve
return unless resolvable?
@first_note_to_resolve ||= notes.find(&:to_be_resolved?)
end
+ # rubocop:disable Cop/ModuleWithInstanceVariables
def last_resolved_note
return unless resolved?
@@ -89,6 +92,7 @@ module ResolvableDiscussion
private
+ # rubocop:disable Cop/ModuleWithInstanceVariables
def update
# Do not select `Note.resolvable`, so that system notes remain in the collection
notes_relation = Note.where(id: notes.map(&:id))