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
f3d4767d
Commit
f3d4767d
authored
Jul 13, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `notice_added_references` to `create_new_cross_references!`
parent
e4c698fd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
12 deletions
+12
-12
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+3
-3
app/models/note.rb
app/models/note.rb
+1
-1
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+1
-1
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+1
-1
spec/models/concerns/mentionable_spec.rb
spec/models/concerns/mentionable_spec.rb
+5
-5
spec/support/mentionable_shared_examples.rb
spec/support/mentionable_shared_examples.rb
+1
-1
No files found.
app/models/concerns/mentionable.rb
View file @
f3d4767d
...
...
@@ -79,9 +79,9 @@ module Mentionable
end
end
#
If the mentionable_text field is about to change, locate any *added* references and create cross references for
#
them. Invoke from an observer's #before_save implementation.
def
notice_added_references
(
p
=
project
,
a
=
author
)
#
When a mentionable field is changed, creates cross-reference notes that
#
don't already exist
def
create_new_cross_references!
(
p
=
project
,
a
=
author
)
changes
=
detect_mentionable_changes
return
if
changes
.
empty?
...
...
app/models/note.rb
View file @
f3d4767d
...
...
@@ -356,7 +356,7 @@ class Note < ActiveRecord::Base
end
def
set_references
notice_added_references
(
project
,
author
)
create_new_cross_references!
(
project
,
author
)
end
def
editable?
...
...
app/services/issues/update_service.rb
View file @
f3d4767d
...
...
@@ -35,7 +35,7 @@ module Issues
create_title_change_note
(
issue
,
issue
.
previous_changes
[
'title'
].
first
)
end
issue
.
notice_added_references
(
issue
.
project
,
current_user
)
issue
.
create_new_cross_references!
(
issue
.
project
,
current_user
)
execute_hooks
(
issue
,
'update'
)
end
...
...
app/services/merge_requests/update_service.rb
View file @
f3d4767d
...
...
@@ -59,7 +59,7 @@ module MergeRequests
merge_request
.
mark_as_unchecked
end
merge_request
.
notice_added_references
(
merge_request
.
project
,
current_user
)
merge_request
.
create_new_cross_references!
(
merge_request
.
project
,
current_user
)
execute_hooks
(
merge_request
,
'update'
)
end
...
...
spec/models/concerns/mentionable_spec.rb
View file @
f3d4767d
...
...
@@ -29,7 +29,7 @@ describe Issue, "Mentionable" do
end
end
describe
'#
notice_added_references
'
do
describe
'#
create_new_cross_references!
'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:issues
)
{
create_list
(
:issue
,
2
,
project:
project
)
}
...
...
@@ -40,7 +40,7 @@ describe Issue, "Mentionable" do
expect
(
SystemNoteService
).
not_to
receive
(
:cross_reference
)
issue
.
description
=
'New description'
issue
.
notice_added_references
issue
.
create_new_cross_references!
end
it
'notifies new references'
do
...
...
@@ -49,7 +49,7 @@ describe Issue, "Mentionable" do
expect
(
SystemNoteService
).
to
receive
(
:cross_reference
).
with
(
issues
[
1
],
any_args
)
issue
.
description
=
issues
[
1
].
to_reference
issue
.
notice_added_references
issue
.
create_new_cross_references!
end
end
...
...
@@ -60,7 +60,7 @@ describe Issue, "Mentionable" do
expect
(
SystemNoteService
).
not_to
receive
(
:cross_reference
)
issue
.
update_attributes
(
description:
'New description'
)
issue
.
notice_added_references
issue
.
create_new_cross_references!
end
it
'notifies new references'
do
...
...
@@ -69,7 +69,7 @@ describe Issue, "Mentionable" do
expect
(
SystemNoteService
).
to
receive
(
:cross_reference
).
with
(
issues
[
1
],
any_args
)
issue
.
update_attributes
(
description:
issues
[
1
].
to_reference
)
issue
.
notice_added_references
issue
.
create_new_cross_references!
end
end
...
...
spec/support/mentionable_shared_examples.rb
View file @
f3d4767d
...
...
@@ -143,6 +143,6 @@ shared_examples 'an editable mentionable' do
end
set_mentionable_text
.
call
(
new_text
)
subject
.
notice_added_references
(
project
,
author
)
subject
.
create_new_cross_references!
(
project
,
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