BigW Consortium Gitlab

Commit 6df22f72 by Douwe Maan

Rephrase some system notes to be compatible with new system note style

parent d0c0c75c
...@@ -171,7 +171,6 @@ class NotificationService ...@@ -171,7 +171,6 @@ class NotificationService
return true unless note.noteable_type.present? return true unless note.noteable_type.present?
# ignore gitlab service messages # ignore gitlab service messages
return true if note.note.start_with?('Status changed to closed')
return true if note.cross_reference? && note.system? return true if note.cross_reference? && note.system?
target = note.noteable target = note.noteable
......
---
title: Rephrase some system notes to be compatible with new system note style
merge_request: 7692
author:
...@@ -21,7 +21,7 @@ Parameters: ...@@ -21,7 +21,7 @@ Parameters:
[ [
{ {
"id": 302, "id": 302,
"body": "Status changed to closed", "body": "closed",
"attachment": null, "attachment": null,
"author": { "author": {
"id": 1, "id": 1,
......
...@@ -515,7 +515,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -515,7 +515,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see new target branch changes' do step 'I should see new target branch changes' do
expect(page).to have_content 'Request to merge fix into feature' expect(page).to have_content 'Request to merge fix into feature'
expect(page).to have_content 'Target branch changed from merge-test to feature' expect(page).to have_content 'changed target branch from merge-test to feature'
wait_for_ajax wait_for_ajax
end end
......
...@@ -179,7 +179,7 @@ module SharedIssuable ...@@ -179,7 +179,7 @@ module SharedIssuable
project = Project.find_by(name: from_project_name) project = Project.find_by(name: from_project_name)
expect(page).to have_content(user_name) expect(page).to have_content(user_name)
expect(page).to have_content("Mentioned in #{issuable.class.to_s.titleize.downcase} #{issuable.to_reference(project)}") expect(page).to have_content("mentioned in #{issuable.class.to_s.titleize.downcase} #{issuable.to_reference(project)}")
end end
def expect_sidebar_content(content) def expect_sidebar_content(content)
......
...@@ -31,7 +31,7 @@ describe Projects::MilestonesController do ...@@ -31,7 +31,7 @@ describe Projects::MilestonesController do
# Check system note left for milestone removal # Check system note left for milestone removal
last_note = project.issues.find(issue.id).notes[-1].note last_note = project.issues.find(issue.id).notes[-1].note
expect(last_note).to eq('Milestone removed') expect(last_note).to eq('removed milestone')
end end
end end
end end
...@@ -27,7 +27,7 @@ feature 'issue move to another project' do ...@@ -27,7 +27,7 @@ feature 'issue move to another project' do
let!(:mr) { create(:merge_request, source_project: old_project) } let!(:mr) { create(:merge_request, source_project: old_project) }
let(:new_project) { create(:project) } let(:new_project) { create(:project) }
let(:new_project_search) { create(:project) } let(:new_project_search) { create(:project) }
let(:text) { 'Text with !1' } let(:text) { "Text with #{mr.to_reference}" }
let(:cross_reference) { old_project.to_reference } let(:cross_reference) { old_project.to_reference }
background do background do
...@@ -43,8 +43,8 @@ feature 'issue move to another project' do ...@@ -43,8 +43,8 @@ feature 'issue move to another project' do
expect(current_url).to include project_path(new_project) expect(current_url).to include project_path(new_project)
expect(page).to have_content("Text with #{cross_reference}!1") expect(page).to have_content("Text with #{cross_reference}#{mr.to_reference}")
expect(page).to have_content("Moved from #{cross_reference}#1") expect(page).to have_content("moved from #{cross_reference}#{issue.to_reference}")
expect(page).to have_content(issue.title) expect(page).to have_content(issue.title)
end end
......
...@@ -20,12 +20,12 @@ feature 'Start new branch from an issue', feature: true do ...@@ -20,12 +20,12 @@ feature 'Start new branch from an issue', feature: true do
context "when there is a referenced merge request" do context "when there is a referenced merge request" do
let!(:note) do let!(:note) do
create(:note, :on_issue, :system, project: project, noteable: issue, create(:note, :on_issue, :system, project: project, noteable: issue,
note: "Mentioned in !#{referenced_mr.iid}") note: "mentioned in #{referenced_mr.to_reference}")
end end
let(:referenced_mr) do let(:referenced_mr) do
create(:merge_request, :simple, source_project: project, target_project: project, create(:merge_request, :simple, source_project: project, target_project: project,
description: "Fixes ##{issue.iid}", author: user) description: "Fixes #{issue.to_reference}", author: user)
end end
before do before do
......
...@@ -44,7 +44,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do ...@@ -44,7 +44,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
expect(page).to have_content "The source branch will not be removed." expect(page).to have_content "The source branch will not be removed."
visit_merge_request(merge_request) # Needed to refresh the page visit_merge_request(merge_request) # Needed to refresh the page
expect(page).to have_content /Enabled an automatic merge when the build for [0-9a-f]{8} succeeds/i expect(page).to have_content /enabled an automatic merge when the build for \h{8} succeeds/i
end end
end end
end end
......
...@@ -141,7 +141,7 @@ describe 'Comments', feature: true do ...@@ -141,7 +141,7 @@ describe 'Comments', feature: true do
let(:project2) { create(:project, :private) } let(:project2) { create(:project, :private) }
let(:issue) { create(:issue, project: project2) } let(:issue) { create(:issue, project: project2) }
let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'markdown') } let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'markdown') }
let!(:note) { create(:note_on_merge_request, :system, noteable: merge_request, project: project, note: "Mentioned in #{issue.to_reference(project)}") } let!(:note) { create(:note_on_merge_request, :system, noteable: merge_request, project: project, note: "mentioned in #{issue.to_reference(project)}") }
it 'shows the system note' do it 'shows the system note' do
login_as :admin login_as :admin
......
...@@ -223,7 +223,7 @@ describe Note, models: true do ...@@ -223,7 +223,7 @@ describe Note, models: true do
let(:note) do let(:note) do
create :note, create :note,
noteable: ext_issue, project: ext_proj, noteable: ext_issue, project: ext_proj,
note: "Mentioned in issue #{private_issue.to_reference(ext_proj)}", note: "mentioned in issue #{private_issue.to_reference(ext_proj)}",
system: true system: true
end end
......
...@@ -25,7 +25,7 @@ describe API::API, api: true do ...@@ -25,7 +25,7 @@ describe API::API, api: true do
let!(:cross_reference_note) do let!(:cross_reference_note) do
create :note, create :note,
noteable: ext_issue, project: ext_proj, noteable: ext_issue, project: ext_proj,
note: "Mentioned in issue #{private_issue.to_reference(ext_proj)}", note: "mentioned in issue #{private_issue.to_reference(ext_proj)}",
system: true system: true
end end
......
...@@ -62,7 +62,7 @@ describe Issues::CloseService, services: true do ...@@ -62,7 +62,7 @@ describe Issues::CloseService, services: true do
it 'creates system note about issue reassign' do it 'creates system note about issue reassign' do
note = issue.notes.last note = issue.notes.last
expect(note.note).to include "Status changed to closed" expect(note.note).to include "closed"
end end
it 'marks todos as done' do it 'marks todos as done' do
......
...@@ -81,11 +81,11 @@ describe Issues::MoveService, services: true do ...@@ -81,11 +81,11 @@ describe Issues::MoveService, services: true do
end end
it 'adds system note to old issue at the end' do it 'adds system note to old issue at the end' do
expect(old_issue.notes.last.note).to match /^Moved to/ expect(old_issue.notes.last.note).to start_with 'moved to'
end end
it 'adds system note to new issue at the end' do it 'adds system note to new issue at the end' do
expect(new_issue.notes.last.note).to match /^Moved from/ expect(new_issue.notes.last.note).to start_with 'moved from'
end end
it 'closes old issue' do it 'closes old issue' do
...@@ -151,7 +151,7 @@ describe Issues::MoveService, services: true do ...@@ -151,7 +151,7 @@ describe Issues::MoveService, services: true do
end end
it 'adds a system note about move after rewritten notes' do it 'adds a system note about move after rewritten notes' do
expect(system_notes.last.note).to match /^Moved from/ expect(system_notes.last.note).to match /^moved from/
end end
it 'preserves orignal author of comment' do it 'preserves orignal author of comment' do
......
...@@ -91,24 +91,24 @@ describe Issues::UpdateService, services: true do ...@@ -91,24 +91,24 @@ describe Issues::UpdateService, services: true do
end end
it 'creates system note about issue reassign' do it 'creates system note about issue reassign' do
note = find_note('Reassigned to') note = find_note('assigned to')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to include "Reassigned to \@#{user2.username}" expect(note.note).to include "assigned to #{user2.to_reference}"
end end
it 'creates system note about issue label edit' do it 'creates system note about issue label edit' do
note = find_note('Added ~') note = find_note('added ~')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to include "Added ~#{label.id} label" expect(note.note).to include "added #{label.to_reference} label"
end end
it 'creates system note about title change' do it 'creates system note about title change' do
note = find_note('Changed title:') note = find_note('changed title')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to eq 'Changed title: **{-Old-} title** → **{+New+} title**' expect(note.note).to eq 'changed title from **{-Old-} title** to **{+New+} title**'
end end
end end
end end
...@@ -128,10 +128,10 @@ describe Issues::UpdateService, services: true do ...@@ -128,10 +128,10 @@ describe Issues::UpdateService, services: true do
it 'creates system note about confidentiality change' do it 'creates system note about confidentiality change' do
update_issue(confidential: true) update_issue(confidential: true)
note = find_note('Made the issue confidential') note = find_note('made the issue confidential')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to eq 'Made the issue confidential' expect(note.note).to eq 'made the issue confidential'
end end
it 'executes confidential issue hooks' do it 'executes confidential issue hooks' do
...@@ -269,8 +269,8 @@ describe Issues::UpdateService, services: true do ...@@ -269,8 +269,8 @@ describe Issues::UpdateService, services: true do
before { update_issue(description: "- [x] Task 1\n- [X] Task 2") } before { update_issue(description: "- [x] Task 1\n- [X] Task 2") }
it 'creates system note about task status change' do it 'creates system note about task status change' do
note1 = find_note('Marked the task **Task 1** as completed') note1 = find_note('marked the task **Task 1** as completed')
note2 = find_note('Marked the task **Task 2** as completed') note2 = find_note('marked the task **Task 2** as completed')
expect(note1).not_to be_nil expect(note1).not_to be_nil
expect(note2).not_to be_nil expect(note2).not_to be_nil
...@@ -284,8 +284,8 @@ describe Issues::UpdateService, services: true do ...@@ -284,8 +284,8 @@ describe Issues::UpdateService, services: true do
end end
it 'creates system note about task status change' do it 'creates system note about task status change' do
note1 = find_note('Marked the task **Task 1** as incomplete') note1 = find_note('marked the task **Task 1** as incomplete')
note2 = find_note('Marked the task **Task 2** as incomplete') note2 = find_note('marked the task **Task 2** as incomplete')
expect(note1).not_to be_nil expect(note1).not_to be_nil
expect(note2).not_to be_nil expect(note2).not_to be_nil
...@@ -299,7 +299,7 @@ describe Issues::UpdateService, services: true do ...@@ -299,7 +299,7 @@ describe Issues::UpdateService, services: true do
end end
it 'does not create a system note' do it 'does not create a system note' do
note = find_note('Marked the task **Task 2** as incomplete') note = find_note('marked the task **Task 2** as incomplete')
expect(note).to be_nil expect(note).to be_nil
end end
...@@ -312,7 +312,7 @@ describe Issues::UpdateService, services: true do ...@@ -312,7 +312,7 @@ describe Issues::UpdateService, services: true do
end end
it 'does not create a system note referencing the position the old item' do it 'does not create a system note referencing the position the old item' do
note = find_note('Marked the task **Two** as incomplete') note = find_note('marked the task **Two** as incomplete')
expect(note).to be_nil expect(note).to be_nil
end end
......
...@@ -42,7 +42,7 @@ describe MergeRequests::CloseService, services: true do ...@@ -42,7 +42,7 @@ describe MergeRequests::CloseService, services: true do
it 'creates system note about merge_request reassign' do it 'creates system note about merge_request reassign' do
note = @merge_request.notes.last note = @merge_request.notes.last
expect(note.note).to include 'Status changed to closed' expect(note.note).to include 'closed'
end end
it 'marks todos as done' do it 'marks todos as done' do
......
...@@ -34,7 +34,7 @@ describe MergeRequests::MergeService, services: true do ...@@ -34,7 +34,7 @@ describe MergeRequests::MergeService, services: true do
it 'creates system note about merge_request merge' do it 'creates system note about merge_request merge' do
note = merge_request.notes.last note = merge_request.notes.last
expect(note.note).to include 'Status changed to merged' expect(note.note).to include 'merged'
end end
end end
......
...@@ -34,7 +34,7 @@ describe MergeRequests::MergeWhenBuildSucceedsService do ...@@ -34,7 +34,7 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
it 'creates a system note' do it 'creates a system note' do
note = merge_request.notes.last note = merge_request.notes.last
expect(note.note).to match /Enabled an automatic merge when the build for (\w+\/\w+@)?[0-9a-z]{8}/ expect(note.note).to match /enabled an automatic merge when the build for (\w+\/\w+@)?\h{8}/
end end
end end
...@@ -113,7 +113,7 @@ describe MergeRequests::MergeWhenBuildSucceedsService do ...@@ -113,7 +113,7 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
it 'Posts a system note' do it 'Posts a system note' do
note = mr_merge_if_green_enabled.notes.last note = mr_merge_if_green_enabled.notes.last
expect(note.note).to include 'Canceled the automatic merge' expect(note.note).to include 'canceled the automatic merge'
end end
end end
......
...@@ -76,10 +76,10 @@ describe MergeRequests::RefreshService, services: true do ...@@ -76,10 +76,10 @@ describe MergeRequests::RefreshService, services: true do
reload_mrs reload_mrs
end end
it { expect(@merge_request.notes.last.note).to include('changed to merged') } it { expect(@merge_request.notes.last.note).to include('merged') }
it { expect(@merge_request).to be_merged } it { expect(@merge_request).to be_merged }
it { expect(@fork_merge_request).to be_merged } it { expect(@fork_merge_request).to be_merged }
it { expect(@fork_merge_request.notes.last.note).to include('changed to merged') } it { expect(@fork_merge_request.notes.last.note).to include('merged') }
it { expect(@build_failed_todo).to be_done } it { expect(@build_failed_todo).to be_done }
it { expect(@fork_build_failed_todo).to be_done } it { expect(@fork_build_failed_todo).to be_done }
end end
...@@ -95,11 +95,11 @@ describe MergeRequests::RefreshService, services: true do ...@@ -95,11 +95,11 @@ describe MergeRequests::RefreshService, services: true do
reload_mrs reload_mrs
end end
it { expect(@merge_request.notes.last.note).to include('changed to merged') } it { expect(@merge_request.notes.last.note).to include('merged') }
it { expect(@merge_request).to be_merged } it { expect(@merge_request).to be_merged }
it { expect(@merge_request.diffs.size).to be > 0 } it { expect(@merge_request.diffs.size).to be > 0 }
it { expect(@fork_merge_request).to be_merged } it { expect(@fork_merge_request).to be_merged }
it { expect(@fork_merge_request.notes.last.note).to include('changed to merged') } it { expect(@fork_merge_request.notes.last.note).to include('merged') }
it { expect(@build_failed_todo).to be_done } it { expect(@build_failed_todo).to be_done }
it { expect(@fork_build_failed_todo).to be_done } it { expect(@fork_build_failed_todo).to be_done }
end end
...@@ -119,7 +119,7 @@ describe MergeRequests::RefreshService, services: true do ...@@ -119,7 +119,7 @@ describe MergeRequests::RefreshService, services: true do
it { expect(@merge_request.notes).to be_empty } it { expect(@merge_request.notes).to be_empty }
it { expect(@merge_request).to be_open } it { expect(@merge_request).to be_open }
it { expect(@fork_merge_request.notes.last.note).to include('Added 28 commits') } it { expect(@fork_merge_request.notes.last.note).to include('added 28 commits') }
it { expect(@fork_merge_request).to be_open } it { expect(@fork_merge_request).to be_open }
it { expect(@build_failed_todo).to be_pending } it { expect(@build_failed_todo).to be_pending }
it { expect(@fork_build_failed_todo).to be_pending } it { expect(@fork_build_failed_todo).to be_pending }
...@@ -146,7 +146,7 @@ describe MergeRequests::RefreshService, services: true do ...@@ -146,7 +146,7 @@ describe MergeRequests::RefreshService, services: true do
reload_mrs reload_mrs
end end
it { expect(@merge_request.notes.last.note).to include('changed to merged') } it { expect(@merge_request.notes.last.note).to include('merged') }
it { expect(@merge_request).to be_merged } it { expect(@merge_request).to be_merged }
it { expect(@fork_merge_request).to be_open } it { expect(@fork_merge_request).to be_open }
it { expect(@fork_merge_request.notes).to be_empty } it { expect(@fork_merge_request.notes).to be_empty }
...@@ -169,8 +169,8 @@ describe MergeRequests::RefreshService, services: true do ...@@ -169,8 +169,8 @@ describe MergeRequests::RefreshService, services: true do
expect(@merge_request).to be_open expect(@merge_request).to be_open
notes = @fork_merge_request.notes.reorder(:created_at).map(&:note) notes = @fork_merge_request.notes.reorder(:created_at).map(&:note)
expect(notes[0]).to include('Restored source branch `master`') expect(notes[0]).to include('restored source branch `master`')
expect(notes[1]).to include('Added 28 commits') expect(notes[1]).to include('added 28 commits')
expect(@fork_merge_request).to be_open expect(@fork_merge_request).to be_open
end end
end end
......
...@@ -41,7 +41,7 @@ describe MergeRequests::ReopenService, services: true do ...@@ -41,7 +41,7 @@ describe MergeRequests::ReopenService, services: true do
it 'creates system note about merge_request reopen' do it 'creates system note about merge_request reopen' do
note = merge_request.notes.last note = merge_request.notes.last
expect(note.note).to include 'Status changed to reopened' expect(note.note).to include 'reopened'
end end
end end
......
...@@ -79,31 +79,31 @@ describe MergeRequests::UpdateService, services: true do ...@@ -79,31 +79,31 @@ describe MergeRequests::UpdateService, services: true do
end end
it 'creates system note about merge_request reassign' do it 'creates system note about merge_request reassign' do
note = find_note('Reassigned to') note = find_note('assigned to')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to include "Reassigned to \@#{user2.username}" expect(note.note).to include "assigned to #{user2.to_reference}"
end end
it 'creates system note about merge_request label edit' do it 'creates system note about merge_request label edit' do
note = find_note('Added ~') note = find_note('added ~')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to include "Added ~#{label.id} label" expect(note.note).to include "added #{label.to_reference} label"
end end
it 'creates system note about title change' do it 'creates system note about title change' do
note = find_note('Changed title:') note = find_note('changed title')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to eq 'Changed title: **{-Old-} title** → **{+New+} title**' expect(note.note).to eq 'changed title from **{-Old-} title** to **{+New+} title**'
end end
it 'creates system note about branch change' do it 'creates system note about branch change' do
note = find_note('Target') note = find_note('changed target')
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to eq 'Target branch changed from `master` to `target`' expect(note.note).to eq 'changed target branch from `master` to `target`'
end end
context 'when not including source branch removal options' do context 'when not including source branch removal options' do
...@@ -258,8 +258,8 @@ describe MergeRequests::UpdateService, services: true do ...@@ -258,8 +258,8 @@ describe MergeRequests::UpdateService, services: true do
before { update_merge_request({ description: "- [x] Task 1\n- [X] Task 2" }) } before { update_merge_request({ description: "- [x] Task 1\n- [X] Task 2" }) }
it 'creates system note about task status change' do it 'creates system note about task status change' do
note1 = find_note('Marked the task **Task 1** as completed') note1 = find_note('marked the task **Task 1** as completed')
note2 = find_note('Marked the task **Task 2** as completed') note2 = find_note('marked the task **Task 2** as completed')
expect(note1).not_to be_nil expect(note1).not_to be_nil
expect(note2).not_to be_nil expect(note2).not_to be_nil
...@@ -273,8 +273,8 @@ describe MergeRequests::UpdateService, services: true do ...@@ -273,8 +273,8 @@ describe MergeRequests::UpdateService, services: true do
end end
it 'creates system note about task status change' do it 'creates system note about task status change' do
note1 = find_note('Marked the task **Task 1** as incomplete') note1 = find_note('marked the task **Task 1** as incomplete')
note2 = find_note('Marked the task **Task 2** as incomplete') note2 = find_note('marked the task **Task 2** as incomplete')
expect(note1).not_to be_nil expect(note1).not_to be_nil
expect(note2).not_to be_nil expect(note2).not_to be_nil
......
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