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
Tatuya Kamada
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
Show 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
refs
.
reject!
{
|
ref
|
without
.
include?
(
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
...
...
app/models/note.rb
View file @
2120e2dd
...
...
@@ -63,11 +63,6 @@ class Note < ActiveRecord::Base
after_update
:set_references
class
<<
self
# TODO (rspeicher): Update usages
def
create_cross_reference_note
(
*
args
)
SystemNoteService
.
cross_reference
(
*
args
)
end
def
discussions_from_notes
(
notes
)
discussion_ids
=
[]
discussions
=
[]
...
...
app/services/git_push_service.rb
View file @
2120e2dd
...
...
@@ -105,7 +105,7 @@ class GitPushService
author
||=
commit_user
(
commit
)
refs
.
each
do
|
r
|
Note
.
create_cross_reference_not
e
(
r
,
commit
,
author
)
SystemNoteService
.
cross_referenc
e
(
r
,
commit
,
author
)
end
end
end
...
...
app/services/notes/create_service.rb
View file @
2120e2dd
...
...
@@ -15,7 +15,7 @@ module Notes
# Create a cross-reference note if this Note contains GFM that names an
# issue, merge request, or commit.
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
execute_hooks
(
note
)
...
...
app/services/notes/update_service.rb
View file @
2120e2dd
...
...
@@ -13,7 +13,7 @@ module Notes
# Create a cross-reference note if this Note contains GFM that
# names an issue, merge request, or commit.
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
...
...
spec/models/concerns/mentionable_spec.rb
View file @
2120e2dd
...
...
@@ -23,7 +23,7 @@ describe Issue, "Mentionable" do
end
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
])
end
...
...
spec/services/git_push_service_spec.rb
View file @
2120e2dd
...
...
@@ -166,15 +166,15 @@ describe GitPushService do
end
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
)
end
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
)
end
...
...
@@ -184,7 +184,7 @@ describe GitPushService do
author_name:
'unknown name'
,
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
)
end
...
...
@@ -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
(
"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'
)
end
...
...
spec/services/notification_service_spec.rb
View file @
2120e2dd
...
...
@@ -58,7 +58,7 @@ describe NotificationService do
end
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
)
notification
.
new_note
(
mentioned_note
)
...
...
@@ -130,7 +130,7 @@ describe NotificationService do
end
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
)
notification
.
new_note
(
mentioned_note
)
...
...
spec/support/mentionable_shared_examples.rb
View file @
2120e2dd
...
...
@@ -80,7 +80,7 @@ shared_examples 'a mentionable' do
ext_issue
,
ext_mr
,
ext_commit
]
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
)
end
...
...
@@ -88,7 +88,7 @@ shared_examples 'a mentionable' do
end
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
).
not_to
have_mentioned
(
mentioned_mr
)
...
...
@@ -132,13 +132,13 @@ shared_examples 'an editable mentionable' do
# These three objects were already referenced, and should not receive new
# notes
[
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
)
end
# These two issues are new and should receive reference notes
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
)
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