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
ff3a62aa
Commit
ff3a62aa
authored
May 09, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove legacy special case for emphasized reference notes
parent
cdb69d72
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
49 deletions
+9
-49
app/services/system_note_service.rb
app/services/system_note_service.rb
+9
-13
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+0
-36
No files found.
app/services/system_note_service.rb
View file @
ff3a62aa
...
@@ -196,7 +196,7 @@ class SystemNoteService
...
@@ -196,7 +196,7 @@ class SystemNoteService
end
end
gfm_reference
=
mentioner_gfm_ref
(
noteable
,
mentioner
,
true
)
gfm_reference
=
mentioner_gfm_ref
(
noteable
,
mentioner
,
true
)
notes
=
notes
.
where
(
'note like ?'
,
cross_reference_note_pattern
(
gfm_reference
))
notes
=
notes
.
where
(
note:
cross_reference_note_content
(
gfm_reference
))
notes
.
count
>
0
notes
.
count
>
0
end
end
...
@@ -207,17 +207,14 @@ class SystemNoteService
...
@@ -207,17 +207,14 @@ class SystemNoteService
Note
.
create
(
args
.
merge
(
system:
true
))
Note
.
create
(
args
.
merge
(
system:
true
))
end
end
def
self
.
cross_reference_note_prefix
'mentioned in '
end
# Prepend the mentioner's namespaced project path to the GFM reference for
# Prepend the mentioner's namespaced project path to the GFM reference for
# cross-project references. For same-project references, return the
# cross-project references. For same-project references, return the
# unmodified GFM reference.
# unmodified GFM reference.
def
self
.
mentioner_gfm_ref
(
noteable
,
mentioner
,
cross_reference
=
false
)
def
self
.
mentioner_gfm_ref
(
noteable
,
mentioner
,
cross_reference
=
false
)
if
mentioner
.
is_a?
(
Commit
)
&&
cross_reference
# FIXME (rspeicher): This was breaking things.
return
mentioner
.
gfm_reference
.
sub
(
'commit '
,
'commit %'
)
# if mentioner.is_a?(Commit) && cross_reference
end
# return mentioner.gfm_reference.sub('commit ', 'commit %')
# end
full_gfm_reference
(
mentioner
.
project
,
noteable
.
project
,
mentioner
)
full_gfm_reference
(
mentioner
.
project
,
noteable
.
project
,
mentioner
)
end
end
...
@@ -243,13 +240,12 @@ class SystemNoteService
...
@@ -243,13 +240,12 @@ class SystemNoteService
end
end
end
end
def
self
.
cross_reference_note_
content
(
gfm_reference
)
def
self
.
cross_reference_note_
prefix
cross_reference_note_prefix
+
"
#{
gfm_reference
}
"
'mentioned in '
end
end
def
self
.
cross_reference_note_pattern
(
gfm_reference
)
def
self
.
cross_reference_note_content
(
gfm_reference
)
# Older cross reference notes contained underscores for emphasis
"
#{
cross_reference_note_prefix
}#{
gfm_reference
}
"
"%"
+
cross_reference_note_content
(
gfm_reference
)
+
"%"
end
end
# Build an Array of lines detailing each commit added in a merge request
# Build an Array of lines detailing each commit added in a merge request
...
...
spec/services/system_note_service_spec.rb
View file @
ff3a62aa
...
@@ -313,41 +313,5 @@ describe SystemNoteService do
...
@@ -313,41 +313,5 @@ describe SystemNoteService do
to
be_falsey
to
be_falsey
end
end
end
end
context
'legacy note with Markdown emphasis'
do
let
(
:mentioner
)
{
create
(
:issue
,
project:
project
)
}
before
do
note
=
"_mentioned in issue #
#{
mentioner
.
iid
}
_"
create
(
:system_note
,
noteable:
noteable
,
note:
note
,
project:
project
)
end
it
'detects if a mentionable with emphasis has been mentioned'
do
expect
(
described_class
.
cross_reference_exists?
(
noteable
,
mentioner
)).
to
be_truthy
end
context
'when referenced project has underscores'
do
let
(
:project
)
{
create
(
:empty_project
,
path:
'first_project'
)
}
let
(
:project2
)
{
create
(
:empty_project
,
path:
'second_project'
)
}
let
(
:issue
)
{
mentioner
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project2
)
}
before
do
described_class
.
cross_reference
(
issue
,
issue2
,
author
)
end
it
'is truthy when already mentioned'
do
expect
(
described_class
.
cross_reference_exists?
(
issue
,
issue2
)).
to
be_truthy
end
it
'is falsey when not already mentioned'
do
expect
(
described_class
.
cross_reference_exists?
(
issue2
,
issue
)).
to
be_falsey
end
end
end
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