Skip to content
Snippets Groups Projects
Commit 16c9abf1 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Use cattr_accessor instead duplicating code on NoteOnDiff concern

parent 66c4ed61
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment