summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-07-14 00:28:58 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-07-15 13:49:16 -0300
commit16c9abf1ee95551d130e8b8eb454c440ca4c2eb2 (patch)
treee13feef57f158966cd816a2e48ee3356dd6079cd /app
parent66c4ed6165d5e895ee802d9745205a05dfca9986 (diff)
downloadgitlab-ce-16c9abf1ee95551d130e8b8eb454c440ca4c2eb2.tar.gz
Use cattr_accessor instead duplicating code on NoteOnDiff concern
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/mentionable.rb8
-rw-r--r--app/models/concerns/note_on_diff.rb3
-rw-r--r--app/models/concerns/participable.rb7
3 files changed, 9 insertions, 9 deletions
diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb
index 8cac47246db..ec9e0f1b1d0 100644
--- a/app/models/concerns/mentionable.rb
+++ b/app/models/concerns/mentionable.rb
@@ -14,14 +14,14 @@ module Mentionable
attr = attr.to_s
mentionable_attrs << [attr, options]
end
+ end
+ included do
# Accessor for attributes marked mentionable.
- def mentionable_attrs
- @mentionable_attrs ||= []
+ cattr_accessor :mentionable_attrs, instance_accessor: false do
+ []
end
- end
- included do
if self < Participable
participant -> (user, ext) { all_references(user, extractor: ext) }
end
diff --git a/app/models/concerns/note_on_diff.rb b/app/models/concerns/note_on_diff.rb
index 7b6a28ccf3c..2785fbb21c9 100644
--- a/app/models/concerns/note_on_diff.rb
+++ b/app/models/concerns/note_on_diff.rb
@@ -4,9 +4,6 @@ module NoteOnDiff
NUMBER_OF_TRUNCATED_DIFF_LINES = 16
included do
- attr_mentionable :note, pipeline: :note
- participant :author
-
delegate :blob, :highlighted_diff_lines, to: :diff_file, allow_nil: true
end
diff --git a/app/models/concerns/participable.rb b/app/models/concerns/participable.rb
index 9822844357d..70740c76e43 100644
--- a/app/models/concerns/participable.rb
+++ b/app/models/concerns/participable.rb
@@ -41,9 +41,12 @@ module Participable
def participant(attr)
participant_attrs << attr
end
+ end
- def participant_attrs
- @participant_attrs ||= []
+ included do
+ # Accessor for participant attributes.
+ cattr_accessor :participant_attrs, instance_accessor: false do
+ []
end
end