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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
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
Show 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
...
@@ -14,14 +14,14 @@ module Mentionable
attr
=
attr
.
to_s
attr
=
attr
.
to_s
mentionable_attrs
<<
[
attr
,
options
]
mentionable_attrs
<<
[
attr
,
options
]
end
end
end
included
do
# Accessor for attributes marked mentionable.
# Accessor for attributes marked mentionable.
def
mentionable_attrs
cattr_accessor
:mentionable_attrs
,
instance_accessor:
false
do
@mentionable_attrs
||=
[]
[]
end
end
end
included
do
if
self
<
Participable
if
self
<
Participable
participant
->
(
user
,
ext
)
{
all_references
(
user
,
extractor:
ext
)
}
participant
->
(
user
,
ext
)
{
all_references
(
user
,
extractor:
ext
)
}
end
end
...
...
app/models/concerns/note_on_diff.rb
View file @
16c9abf1
...
@@ -4,9 +4,6 @@ module NoteOnDiff
...
@@ -4,9 +4,6 @@ module NoteOnDiff
NUMBER_OF_TRUNCATED_DIFF_LINES
=
16
NUMBER_OF_TRUNCATED_DIFF_LINES
=
16
included
do
included
do
attr_mentionable
:note
,
pipeline: :note
participant
:author
delegate
:blob
,
:highlighted_diff_lines
,
to: :diff_file
,
allow_nil:
true
delegate
:blob
,
:highlighted_diff_lines
,
to: :diff_file
,
allow_nil:
true
end
end
...
...
app/models/concerns/participable.rb
View file @
16c9abf1
...
@@ -41,9 +41,12 @@ module Participable
...
@@ -41,9 +41,12 @@ module Participable
def
participant
(
attr
)
def
participant
(
attr
)
participant_attrs
<<
attr
participant_attrs
<<
attr
end
end
end
def
participant_attrs
included
do
@participant_attrs
||=
[]
# Accessor for participant attributes.
cattr_accessor
:participant_attrs
,
instance_accessor:
false
do
[]
end
end
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