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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
3e8efce3
Commit
3e8efce3
authored
May 10, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor SystemNoteService.cross_reference_disallowed?
parent
83904275
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
app/services/system_note_service.rb
app/services/system_note_service.rb
+13
-6
No files found.
app/services/system_note_service.rb
View file @
3e8efce3
...
@@ -171,13 +171,20 @@ class SystemNoteService
...
@@ -171,13 +171,20 @@ class SystemNoteService
note_text
.
start_with?
(
cross_reference_note_prefix
)
note_text
.
start_with?
(
cross_reference_note_prefix
)
end
end
# Determine if cross reference note should be created.
# Check if a cross-reference is disallowed
# eg. mentioning a commit in MR comments which exists inside a MR
#
# should not create "mentioned in" note.
# This method prevents adding a "mentioned in !1" note on every single commit
# in a merge request.
#
# noteable - Noteable object being referenced
# mentioner - Mentionable object
#
# Returns Boolean
def
self
.
cross_reference_disallowed?
(
noteable
,
mentioner
)
def
self
.
cross_reference_disallowed?
(
noteable
,
mentioner
)
if
mentioner
.
kind_of?
(
MergeRequest
)
return
false
unless
MergeRequest
===
mentioner
mentioner
.
commits
.
map
(
&
:id
).
include?
noteable
.
id
return
false
unless
Commit
===
noteable
end
mentioner
.
commits
.
include?
(
noteable
)
end
end
def
self
.
cross_reference_exists?
(
noteable
,
mentioner
)
def
self
.
cross_reference_exists?
(
noteable
,
mentioner
)
...
...
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