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
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
49 deletions
+9
-49
system_note_service.rb
app/services/system_note_service.rb
+9
-13
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
end
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
end
...
...
@@ -207,17 +207,14 @@ class SystemNoteService
Note
.
create
(
args
.
merge
(
system:
true
))
end
def
self
.
cross_reference_note_prefix
'mentioned in '
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.
def
self
.
mentioner_gfm_ref
(
noteable
,
mentioner
,
cross_reference
=
false
)
if
mentioner
.
is_a?
(
Commit
)
&&
cross_reference
return
mentioner
.
gfm_reference
.
sub
(
'commit '
,
'commit %'
)
end
# FIXME (rspeicher): This was breaking things.
# if mentioner.is_a?(Commit) && cross_reference
# return mentioner.gfm_reference.sub('commit ', 'commit %')
# end
full_gfm_reference
(
mentioner
.
project
,
noteable
.
project
,
mentioner
)
end
...
...
@@ -243,13 +240,12 @@ class SystemNoteService
end
end
def
self
.
cross_reference_note_
content
(
gfm_reference
)
cross_reference_note_prefix
+
"
#{
gfm_reference
}
"
def
self
.
cross_reference_note_
prefix
'mentioned in '
end
def
self
.
cross_reference_note_pattern
(
gfm_reference
)
# Older cross reference notes contained underscores for emphasis
"%"
+
cross_reference_note_content
(
gfm_reference
)
+
"%"
def
self
.
cross_reference_note_content
(
gfm_reference
)
"
#{
cross_reference_note_prefix
}#{
gfm_reference
}
"
end
# 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
to
be_falsey
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
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