diff options
author | micael.bergeron <micael.bergeron@solutionstlm.com> | 2017-08-02 10:06:28 -0400 |
---|---|---|
committer | micael.bergeron <micael.bergeron@solutionstlm.com> | 2017-09-06 09:00:57 -0400 |
commit | 45b83ed99afc5cfe24a8d84869894124d93d5b51 (patch) | |
tree | d632a83e4b953d627855440defbc3300b1285967 /app/models/note.rb | |
parent | 966b1128d884a318dad4277e23368334fe67e836 (diff) | |
download | gitlab-ce-45b83ed99afc5cfe24a8d84869894124d93d5b51.tar.gz |
round of fixes after code review
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 14 |
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 |