BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
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
note_text
.
start_with?
(
cross_reference_note_prefix
)
end
# Determine if cross reference note should be created.
# eg. mentioning a commit in MR comments which exists inside a MR
# should not create "mentioned in" note.
# Check if a cross-reference is disallowed
#
# 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
)
if
mentioner
.
kind_of?
(
MergeRequest
)
mentioner
.
commits
.
map
(
&
:id
).
include?
noteable
.
id
end
return
false
unless
MergeRequest
===
mentioner
return
false
unless
Commit
===
noteable
mentioner
.
commits
.
include?
(
noteable
)
end
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