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:
authormicael.bergeron <micael.bergeron@solutionstlm.com>2017-08-02 17:06:28 +0300
committermicael.bergeron <micael.bergeron@solutionstlm.com>2017-09-06 16:00:57 +0300
commit45b83ed99afc5cfe24a8d84869894124d93d5b51 (patch)
treed632a83e4b953d627855440defbc3300b1285967 /app/models/note.rb
parent966b1128d884a318dad4277e23368334fe67e836 (diff)
round of fixes after code review
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index d04bccc6e81..28cd54bd81c 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -26,7 +26,6 @@ class Note < ActiveRecord::Base
end
ignore_column :original_discussion_id
- ignore_column :special_role
cache_markdown_field :note, pipeline: :note, issuable_state_filter_enabled: true
@@ -155,6 +154,10 @@ class Note < ActiveRecord::Base
.group(:noteable_id)
.where(noteable_type: type, noteable_id: ids)
end
+
+ def has_special_role?(role, note)
+ note.special_role == role
+ end
end
def cross_reference?
@@ -221,14 +224,19 @@ class Note < ActiveRecord::Base
end
def special_role=(role)
- raise "Role is undefined, #{role} not found in #{SpecialRole.values}" unless SpecialRole.values.include? role
+ raise "Role is undefined, #{role} not found in #{SpecialRole.values}" unless SpecialRole.values.include?(role)
+
@special_role = role
end
def has_special_role?(role)
- return @special_role == role
+ self.class.has_special_role?(role, self)
end
+ def specialize!(role)
+ self.special_role = role if !block_given? || yield(self)
+ end
+
def editable?
!system?
end