Commit 77abf8cc authored by Clement Ho's avatar Clement Ho

Capitalize mentioned issue timeline notes

parent 0b4fef6b
...@@ -11,6 +11,7 @@ v 8.12.0 (unreleased) ...@@ -11,6 +11,7 @@ v 8.12.0 (unreleased)
- Added tests for diff notes - Added tests for diff notes
- Added 'only_allow_merge_if_build_succeeds' project setting in the API. !5930 (Duck) - Added 'only_allow_merge_if_build_succeeds' project setting in the API. !5930 (Duck)
- Reduce number of database queries on builds tab - Reduce number of database queries on builds tab
- Capitalize mentioned issue timeline notes (ClemMakesApps)
- Use the default branch for displaying the project icon instead of master !5792 (Hannes Rosenögger) - Use the default branch for displaying the project icon instead of master !5792 (Hannes Rosenögger)
v 8.11.2 (unreleased) v 8.11.2 (unreleased)
......
...@@ -269,11 +269,11 @@ module SystemNoteService ...@@ -269,11 +269,11 @@ module SystemNoteService
# #
# Example Note text: # Example Note text:
# #
# "mentioned in #1" # "Mentioned in #1"
# #
# "mentioned in !2" # "Mentioned in !2"
# #
# "mentioned in 54f7727c" # "Mentioned in 54f7727c"
# #
# See cross_reference_note_content. # See cross_reference_note_content.
# #
...@@ -308,7 +308,7 @@ module SystemNoteService ...@@ -308,7 +308,7 @@ module SystemNoteService
# Check if a cross-reference is disallowed # Check if a cross-reference is disallowed
# #
# This method prevents adding a "mentioned in !1" note on every single commit # This method prevents adding a "Mentioned in !1" note on every single commit
# in a merge request. Additionally, it prevents the creation of references to # in a merge request. Additionally, it prevents the creation of references to
# external issues (which would fail). # external issues (which would fail).
# #
...@@ -417,7 +417,7 @@ module SystemNoteService ...@@ -417,7 +417,7 @@ module SystemNoteService
end end
def cross_reference_note_prefix def cross_reference_note_prefix
'mentioned in ' 'Mentioned in '
end end
def cross_reference_note_content(gfm_reference) def cross_reference_note_content(gfm_reference)
......
...@@ -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)
......
...@@ -20,7 +20,7 @@ feature 'Start new branch from an issue', feature: true do ...@@ -20,7 +20,7 @@ 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, create(:note, :on_issue, :system, project: project,
note: "mentioned in !#{referenced_mr.iid}") note: "Mentioned in !#{referenced_mr.iid}")
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,
......
...@@ -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
......
...@@ -225,7 +225,7 @@ describe Note, models: true do ...@@ -225,7 +225,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
......
...@@ -330,13 +330,13 @@ describe SystemNoteService, services: true do ...@@ -330,13 +330,13 @@ describe SystemNoteService, services: true do
let(:mentioner) { project2.repository.commit } let(:mentioner) { project2.repository.commit }
it 'references the mentioning commit' do it 'references the mentioning commit' do
expect(subject.note).to eq "mentioned in commit #{mentioner.to_reference(project)}" expect(subject.note).to eq "Mentioned in commit #{mentioner.to_reference(project)}"
end end
end end
context 'from non-Commit' do context 'from non-Commit' do
it 'references the mentioning object' do it 'references the mentioning object' do
expect(subject.note).to eq "mentioned in issue #{mentioner.to_reference(project)}" expect(subject.note).to eq "Mentioned in issue #{mentioner.to_reference(project)}"
end end
end end
end end
...@@ -346,13 +346,13 @@ describe SystemNoteService, services: true do ...@@ -346,13 +346,13 @@ describe SystemNoteService, services: true do
let(:mentioner) { project.repository.commit } let(:mentioner) { project.repository.commit }
it 'references the mentioning commit' do it 'references the mentioning commit' do
expect(subject.note).to eq "mentioned in commit #{mentioner.to_reference}" expect(subject.note).to eq "Mentioned in commit #{mentioner.to_reference}"
end end
end end
context 'from non-Commit' do context 'from non-Commit' do
it 'references the mentioning object' do it 'references the mentioning object' do
expect(subject.note).to eq "mentioned in issue #{mentioner.to_reference}" expect(subject.note).to eq "Mentioned in issue #{mentioner.to_reference}"
end end
end end
end end
...@@ -362,7 +362,7 @@ describe SystemNoteService, services: true do ...@@ -362,7 +362,7 @@ describe SystemNoteService, services: true do
describe '.cross_reference?' do describe '.cross_reference?' do
it 'is truthy when text begins with expected text' do it 'is truthy when text begins with expected text' do
expect(described_class.cross_reference?('mentioned in something')).to be_truthy expect(described_class.cross_reference?('Mentioned in something')).to be_truthy
end end
it 'is falsey when text does not begin with expected text' do it 'is falsey when text does not begin with expected text' do
......
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