Commit f3d4767d authored by Robert Speicher's avatar Robert Speicher

Rename `notice_added_references` to `create_new_cross_references!`

parent e4c698fd
......@@ -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?
......
......@@ -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?
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment