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
iv
gitlab-ce
Commits
f808ecf1
Commit
f808ecf1
authored
Oct 19, 2014
by
Ciro Santilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY mentioned in magic note constant
parent
3880bb61
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
app/models/note.rb
app/models/note.rb
+14
-2
app/services/notification_service.rb
app/services/notification_service.rb
+1
-1
No files found.
app/models/note.rb
View file @
f808ecf1
...
...
@@ -80,7 +80,7 @@ class Note < ActiveRecord::Base
note_options
=
{
project:
project
,
author:
author
,
note:
"_mentioned in
#{
gfm_reference
}
_"
,
note:
cross_reference_note_content
(
gfm_reference
)
,
system:
true
}
...
...
@@ -174,7 +174,7 @@ class Note < ActiveRecord::Base
where
(
noteable_id:
noteable
.
id
)
end
notes
.
where
(
'note like ?'
,
"_mentioned in
#{
gfm_reference
}
_"
).
notes
.
where
(
'note like ?'
,
cross_reference_note_content
(
gfm_reference
)
).
system
.
any?
end
...
...
@@ -182,8 +182,16 @@ class Note < ActiveRecord::Base
where
(
"note like :query"
,
query:
"%
#{
query
}
%"
)
end
def
cross_reference_note_prefix
'_mentioned in '
end
private
def
cross_reference_note_content
(
gfm_reference
)
cross_reference_note_prefix
+
"
#{
gfm_reference
}
_"
end
# Prepend the mentioner's namespaced project path to the GFM reference for
# cross-project references. For same-project references, return the
# unmodified GFM reference.
...
...
@@ -249,6 +257,10 @@ class Note < ActiveRecord::Base
nil
end
def
cross_reference?
note
.
start_with?
(
self
.
class
.
cross_reference_note_prefix
)
end
def
find_diff
return
nil
unless
noteable
&&
noteable
.
diffs
.
present?
...
...
app/services/notification_service.rb
View file @
f808ecf1
...
...
@@ -119,7 +119,7 @@ class NotificationService
# ignore gitlab service messages
return
true
if
note
.
note
=~
/\A_Status changed to closed_/
return
true
if
note
.
note
=~
/\A_mentioned in /
&&
note
.
system
==
true
return
true
if
note
.
cross_reference?
&&
note
.
system
==
true
opts
=
{
noteable_type:
note
.
noteable_type
,
project_id:
note
.
project_id
}
...
...
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