Commit 4e1ba814 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '322728-aqualls-system-note' into 'master'

Fix awkward phrasing in retarget messaging

See merge request gitlab-org/gitlab!55119
parents a5fa4a8f 10131a4e
......@@ -175,7 +175,7 @@ module SystemNoteService
# Example Note text is based on event_type:
#
# update: "changed target branch from `Old` to `New`"
# delete: "changed automatically target branch to `New` because `Old` was deleted"
# delete: "deleted the `Old` branch. This merge request now targets the `New` branch"
#
# Returns the created Note object
def change_branch(noteable, project, author, branch_type, event_type, old_branch, new_branch)
......
......@@ -90,14 +90,14 @@ module SystemNotes
# Example Note text is based on event_type:
#
# update: "changed target branch from `Old` to `New`"
# delete: "changed automatically target branch to `New` because `Old` was deleted"
# delete: "deleted the `Old` branch. This merge request now targets the `New` branch"
#
# Returns the created Note object
def change_branch(branch_type, event_type, old_branch, new_branch)
body =
case event_type.to_s
when 'delete'
"changed automatically #{branch_type} branch to `#{new_branch}` because `#{old_branch}` was deleted"
"deleted the `#{old_branch}` branch. This merge request now targets the `#{new_branch}` branch"
when 'update'
"changed #{branch_type} branch from `#{old_branch}` to `#{new_branch}`"
else
......
......@@ -189,7 +189,7 @@ RSpec.describe ::SystemNotes::MergeRequestsService do
subject { service.change_branch('target', 'delete', old_branch, new_branch) }
it 'sets the note text' do
expect(subject.note).to eq "changed automatically target branch to `#{new_branch}` because `#{old_branch}` was deleted"
expect(subject.note).to eq "deleted the `#{old_branch}` branch. This merge request now targets the `#{new_branch}` branch"
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