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
Jérome Perrin
gitlab-ce
Commits
2120e2dd
Commit
2120e2dd
authored
Jun 17, 2015
by
Robert Speicher
Committed by
Dmitriy Zaporozhets
Jun 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace remaining references to `Note.create_cross_reference_note`
parent
213d1a47
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
16 additions
and
21 deletions
+16
-21
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+1
-1
app/models/note.rb
app/models/note.rb
+0
-5
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-1
app/services/notes/create_service.rb
app/services/notes/create_service.rb
+1
-1
app/services/notes/update_service.rb
app/services/notes/update_service.rb
+1
-1
spec/models/concerns/mentionable_spec.rb
spec/models/concerns/mentionable_spec.rb
+1
-1
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+5
-5
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+2
-2
spec/support/mentionable_shared_examples.rb
spec/support/mentionable_shared_examples.rb
+4
-4
No files found.
app/models/concerns/mentionable.rb
View file @
2120e2dd
...
@@ -75,7 +75,7 @@ module Mentionable
...
@@ -75,7 +75,7 @@ module Mentionable
refs
.
reject!
{
|
ref
|
without
.
include?
(
ref
)
}
refs
.
reject!
{
|
ref
|
without
.
include?
(
ref
)
}
refs
.
each
do
|
ref
|
refs
.
each
do
|
ref
|
Note
.
create_cross_reference_not
e
(
ref
,
local_reference
,
a
)
SystemNoteService
.
cross_referenc
e
(
ref
,
local_reference
,
a
)
end
end
end
end
...
...
app/models/note.rb
View file @
2120e2dd
...
@@ -63,11 +63,6 @@ class Note < ActiveRecord::Base
...
@@ -63,11 +63,6 @@ class Note < ActiveRecord::Base
after_update
:set_references
after_update
:set_references
class
<<
self
class
<<
self
# TODO (rspeicher): Update usages
def
create_cross_reference_note
(
*
args
)
SystemNoteService
.
cross_reference
(
*
args
)
end
def
discussions_from_notes
(
notes
)
def
discussions_from_notes
(
notes
)
discussion_ids
=
[]
discussion_ids
=
[]
discussions
=
[]
discussions
=
[]
...
...
app/services/git_push_service.rb
View file @
2120e2dd
...
@@ -105,7 +105,7 @@ class GitPushService
...
@@ -105,7 +105,7 @@ class GitPushService
author
||=
commit_user
(
commit
)
author
||=
commit_user
(
commit
)
refs
.
each
do
|
r
|
refs
.
each
do
|
r
|
Note
.
create_cross_reference_not
e
(
r
,
commit
,
author
)
SystemNoteService
.
cross_referenc
e
(
r
,
commit
,
author
)
end
end
end
end
end
end
...
...
app/services/notes/create_service.rb
View file @
2120e2dd
...
@@ -15,7 +15,7 @@ module Notes
...
@@ -15,7 +15,7 @@ module Notes
# Create a cross-reference note if this Note contains GFM that names an
# Create a cross-reference note if this Note contains GFM that names an
# issue, merge request, or commit.
# issue, merge request, or commit.
note
.
references
.
each
do
|
mentioned
|
note
.
references
.
each
do
|
mentioned
|
Note
.
create_cross_reference_not
e
(
mentioned
,
note
.
noteable
,
note
.
author
)
SystemNoteService
.
cross_referenc
e
(
mentioned
,
note
.
noteable
,
note
.
author
)
end
end
execute_hooks
(
note
)
execute_hooks
(
note
)
...
...
app/services/notes/update_service.rb
View file @
2120e2dd
...
@@ -13,7 +13,7 @@ module Notes
...
@@ -13,7 +13,7 @@ module Notes
# Create a cross-reference note if this Note contains GFM that
# Create a cross-reference note if this Note contains GFM that
# names an issue, merge request, or commit.
# names an issue, merge request, or commit.
note
.
references
.
each
do
|
mentioned
|
note
.
references
.
each
do
|
mentioned
|
Note
.
create_cross_reference_not
e
(
mentioned
,
note
.
noteable
,
note
.
author
)
SystemNoteService
.
cross_referenc
e
(
mentioned
,
note
.
noteable
,
note
.
author
)
end
end
end
end
end
end
...
...
spec/models/concerns/mentionable_spec.rb
View file @
2120e2dd
...
@@ -23,7 +23,7 @@ describe Issue, "Mentionable" do
...
@@ -23,7 +23,7 @@ describe Issue, "Mentionable" do
end
end
it
'correctly removes already-mentioned Commits'
do
it
'correctly removes already-mentioned Commits'
do
expect
(
Note
).
not_to
receive
(
:create_cross_reference_not
e
)
expect
(
SystemNoteService
).
not_to
receive
(
:cross_referenc
e
)
issue
.
create_cross_references!
(
project
,
author
,
[
commit2
])
issue
.
create_cross_references!
(
project
,
author
,
[
commit2
])
end
end
...
...
spec/services/git_push_service_spec.rb
View file @
2120e2dd
...
@@ -166,15 +166,15 @@ describe GitPushService do
...
@@ -166,15 +166,15 @@ describe GitPushService do
end
end
it
"creates a note if a pushed commit mentions an issue"
do
it
"creates a note if a pushed commit mentions an issue"
do
expect
(
Note
).
to
receive
(
:create_cross_reference_not
e
).
with
(
issue
,
commit
,
commit_author
)
expect
(
SystemNoteService
).
to
receive
(
:cross_referenc
e
).
with
(
issue
,
commit
,
commit_author
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
end
end
it
"only creates a cross-reference note if one doesn't already exist"
do
it
"only creates a cross-reference note if one doesn't already exist"
do
Note
.
create_cross_reference_not
e
(
issue
,
commit
,
user
)
SystemNoteService
.
cross_referenc
e
(
issue
,
commit
,
user
)
expect
(
Note
).
not_to
receive
(
:create_cross_reference_not
e
).
with
(
issue
,
commit
,
commit_author
)
expect
(
SystemNoteService
).
not_to
receive
(
:cross_referenc
e
).
with
(
issue
,
commit
,
commit_author
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
end
end
...
@@ -184,7 +184,7 @@ describe GitPushService do
...
@@ -184,7 +184,7 @@ describe GitPushService do
author_name:
'unknown name'
,
author_name:
'unknown name'
,
author_email:
'unknown@email.com'
author_email:
'unknown@email.com'
)
)
expect
(
Note
).
to
receive
(
:create_cross_reference_not
e
).
with
(
issue
,
commit
,
user
)
expect
(
SystemNoteService
).
to
receive
(
:cross_referenc
e
).
with
(
issue
,
commit
,
user
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
end
end
...
@@ -193,7 +193,7 @@ describe GitPushService do
...
@@ -193,7 +193,7 @@ describe GitPushService do
allow
(
project
.
repository
).
to
receive
(
:commits_between
).
with
(
@blankrev
,
@newrev
).
and_return
([])
allow
(
project
.
repository
).
to
receive
(
:commits_between
).
with
(
@blankrev
,
@newrev
).
and_return
([])
allow
(
project
.
repository
).
to
receive
(
:commits_between
).
with
(
"master"
,
@newrev
).
and_return
([
commit
])
allow
(
project
.
repository
).
to
receive
(
:commits_between
).
with
(
"master"
,
@newrev
).
and_return
([
commit
])
expect
(
Note
).
to
receive
(
:create_cross_reference_not
e
).
with
(
issue
,
commit
,
commit_author
)
expect
(
SystemNoteService
).
to
receive
(
:cross_referenc
e
).
with
(
issue
,
commit
,
commit_author
)
service
.
execute
(
project
,
user
,
@blankrev
,
@newrev
,
'refs/heads/other'
)
service
.
execute
(
project
,
user
,
@blankrev
,
@newrev
,
'refs/heads/other'
)
end
end
...
...
spec/services/notification_service_spec.rb
View file @
2120e2dd
...
@@ -58,7 +58,7 @@ describe NotificationService do
...
@@ -58,7 +58,7 @@ describe NotificationService do
end
end
it
'filters out "mentioned in" notes'
do
it
'filters out "mentioned in" notes'
do
mentioned_note
=
Note
.
create_cross_reference_not
e
(
mentioned_issue
,
issue
,
issue
.
author
)
mentioned_note
=
SystemNoteService
.
cross_referenc
e
(
mentioned_issue
,
issue
,
issue
.
author
)
expect
(
Notify
).
not_to
receive
(
:note_issue_email
)
expect
(
Notify
).
not_to
receive
(
:note_issue_email
)
notification
.
new_note
(
mentioned_note
)
notification
.
new_note
(
mentioned_note
)
...
@@ -130,7 +130,7 @@ describe NotificationService do
...
@@ -130,7 +130,7 @@ describe NotificationService do
end
end
it
'filters out "mentioned in" notes'
do
it
'filters out "mentioned in" notes'
do
mentioned_note
=
Note
.
create_cross_reference_not
e
(
mentioned_issue
,
issue
,
issue
.
author
)
mentioned_note
=
SystemNoteService
.
cross_referenc
e
(
mentioned_issue
,
issue
,
issue
.
author
)
expect
(
Notify
).
not_to
receive
(
:note_issue_email
)
expect
(
Notify
).
not_to
receive
(
:note_issue_email
)
notification
.
new_note
(
mentioned_note
)
notification
.
new_note
(
mentioned_note
)
...
...
spec/support/mentionable_shared_examples.rb
View file @
2120e2dd
...
@@ -80,7 +80,7 @@ shared_examples 'a mentionable' do
...
@@ -80,7 +80,7 @@ shared_examples 'a mentionable' do
ext_issue
,
ext_mr
,
ext_commit
]
ext_issue
,
ext_mr
,
ext_commit
]
mentioned_objects
.
each
do
|
referenced
|
mentioned_objects
.
each
do
|
referenced
|
expect
(
Note
).
to
receive
(
:create_cross_reference_not
e
).
expect
(
SystemNoteService
).
to
receive
(
:cross_referenc
e
).
with
(
referenced
,
subject
.
local_reference
,
author
)
with
(
referenced
,
subject
.
local_reference
,
author
)
end
end
...
@@ -88,7 +88,7 @@ shared_examples 'a mentionable' do
...
@@ -88,7 +88,7 @@ shared_examples 'a mentionable' do
end
end
it
'detects existing cross-references'
do
it
'detects existing cross-references'
do
Note
.
create_cross_reference_not
e
(
mentioned_issue
,
subject
.
local_reference
,
author
)
SystemNoteService
.
cross_referenc
e
(
mentioned_issue
,
subject
.
local_reference
,
author
)
expect
(
subject
).
to
have_mentioned
(
mentioned_issue
)
expect
(
subject
).
to
have_mentioned
(
mentioned_issue
)
expect
(
subject
).
not_to
have_mentioned
(
mentioned_mr
)
expect
(
subject
).
not_to
have_mentioned
(
mentioned_mr
)
...
@@ -132,13 +132,13 @@ shared_examples 'an editable mentionable' do
...
@@ -132,13 +132,13 @@ shared_examples 'an editable mentionable' do
# These three objects were already referenced, and should not receive new
# These three objects were already referenced, and should not receive new
# notes
# notes
[
mentioned_issue
,
mentioned_commit
,
ext_issue
].
each
do
|
oldref
|
[
mentioned_issue
,
mentioned_commit
,
ext_issue
].
each
do
|
oldref
|
expect
(
Note
).
not_to
receive
(
:create_cross_reference_not
e
).
expect
(
SystemNoteService
).
not_to
receive
(
:cross_referenc
e
).
with
(
oldref
,
any_args
)
with
(
oldref
,
any_args
)
end
end
# These two issues are new and should receive reference notes
# These two issues are new and should receive reference notes
new_issues
.
each
do
|
newref
|
new_issues
.
each
do
|
newref
|
expect
(
Note
).
to
receive
(
:create_cross_reference_not
e
).
expect
(
SystemNoteService
).
to
receive
(
:cross_referenc
e
).
with
(
newref
,
subject
.
local_reference
,
author
)
with
(
newref
,
subject
.
local_reference
,
author
)
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