Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
16c9abf1
Commit
16c9abf1
authored
Jul 14, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use cattr_accessor instead duplicating code on NoteOnDiff concern
parent
66c4ed61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+4
-4
app/models/concerns/note_on_diff.rb
app/models/concerns/note_on_diff.rb
+0
-3
app/models/concerns/participable.rb
app/models/concerns/participable.rb
+5
-2
No files found.
app/models/concerns/mentionable.rb
View file @
16c9abf1
...
...
@@ -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
...
...
app/models/concerns/note_on_diff.rb
View file @
16c9abf1
...
...
@@ -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
...
...
app/models/concerns/participable.rb
View file @
16c9abf1
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment