From ed834c9ff1e7fcb8d5792b64c9f0e69e0eebfbe8 Mon Sep 17 00:00:00 2001 From: Pedro Moreira da Silva Date: Thu, 26 Jan 2017 12:33:35 +0000 Subject: [PATCH 1/4] Make all system notes lowercase --- app/services/system_note_service.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index a11bca00687..6f43f59a985 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -118,16 +118,18 @@ module SystemNoteService # # Example Note text: # - # "Changed estimate of this issue to 3d 5h" + # "removed time estimate on this issue" + # + # "changed time estimate of this issue to 3d 5h" # # Returns the created Note object def change_time_estimate(noteable, project, author) parsed_time = Gitlab::TimeTrackingFormatter.output(noteable.time_estimate) body = if noteable.time_estimate == 0 - "Removed time estimate on this #{noteable.human_class_name}" + "removed time estimate on this #{noteable.human_class_name}" else - "Changed time estimate of this #{noteable.human_class_name} to #{parsed_time}" + "changed time estimate of this #{noteable.human_class_name} to #{parsed_time}" end create_note(noteable: noteable, project: project, author: author, note: body) @@ -142,7 +144,9 @@ module SystemNoteService # # Example Note text: # - # "Added 2h 30m of time spent on this issue" + # "removed time spent on this issue" + # + # "added 2h 30m of time spent on this issue" # # Returns the created Note object @@ -150,10 +154,10 @@ module SystemNoteService time_spent = noteable.time_spent if time_spent == :reset - body = "Removed time spent on this #{noteable.human_class_name}" + body = "removed time spent on this #{noteable.human_class_name}" else parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs) - action = time_spent > 0 ? 'Added' : 'Subtracted' + action = time_spent > 0 ? 'added' : 'subtracted' body = "#{action} #{parsed_time} of time spent on this #{noteable.human_class_name}" end @@ -221,7 +225,7 @@ module SystemNoteService end def discussion_continued_in_issue(discussion, project, author, issue) - body = "Added #{issue.to_reference} to continue this discussion" + body = "created #{issue.to_reference} to continue this discussion" note_attributes = discussion.reply_attributes.merge(project: project, author: author, note: body) note_attributes[:type] = note_attributes.delete(:note_type) @@ -260,7 +264,7 @@ module SystemNoteService # # Example Note text: # - # "made the issue confidential" + # "made the issue confidential" # # Returns the created Note object def change_issue_confidentiality(issue, project, author) From 5316d1cf456df6707f2fb92807162541f96939a0 Mon Sep 17 00:00:00 2001 From: Pedro Moreira da Silva Date: Thu, 26 Jan 2017 13:00:32 +0000 Subject: [PATCH 2/4] Remove noteable object in time tracking system notes [ci-skip] --- app/services/system_note_service.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 6f43f59a985..110072e3a16 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -118,18 +118,18 @@ module SystemNoteService # # Example Note text: # - # "removed time estimate on this issue" + # "removed time estimate" # - # "changed time estimate of this issue to 3d 5h" + # "changed time estimate to 3d 5h" # # Returns the created Note object def change_time_estimate(noteable, project, author) parsed_time = Gitlab::TimeTrackingFormatter.output(noteable.time_estimate) body = if noteable.time_estimate == 0 - "removed time estimate on this #{noteable.human_class_name}" + "removed time estimate" else - "changed time estimate of this #{noteable.human_class_name} to #{parsed_time}" + "changed time estimate to #{parsed_time}" end create_note(noteable: noteable, project: project, author: author, note: body) @@ -144,9 +144,9 @@ module SystemNoteService # # Example Note text: # - # "removed time spent on this issue" + # "removed time spent" # - # "added 2h 30m of time spent on this issue" + # "added 2h 30m of time spent" # # Returns the created Note object @@ -154,11 +154,11 @@ module SystemNoteService time_spent = noteable.time_spent if time_spent == :reset - body = "removed time spent on this #{noteable.human_class_name}" + body = "removed time spent" else parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs) action = time_spent > 0 ? 'added' : 'subtracted' - body = "#{action} #{parsed_time} of time spent on this #{noteable.human_class_name}" + body = "#{action} #{parsed_time} of time spent" end create_note(noteable: noteable, project: project, author: author, note: body) From bbdb6a111106ca17573a83f52afa043b7f5e0299 Mon Sep 17 00:00:00 2001 From: Pedro Moreira da Silva Date: Fri, 3 Feb 2017 16:57:44 +0000 Subject: [PATCH 3/4] Update system_note_service_spec.rb --- spec/services/system_note_service_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index bd7269045e1..7913a180f9b 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -752,13 +752,13 @@ describe SystemNoteService, services: true do it 'sets the note text' do noteable.update_attribute(:time_estimate, 277200) - expect(subject.note).to eq "Changed time estimate of this issue to 1w 4d 5h" + expect(subject.note).to eq "changed time estimate to 1w 4d 5h" end end context 'without a time estimate' do it 'sets the note text' do - expect(subject.note).to eq "Removed time estimate on this issue" + expect(subject.note).to eq "removed time estimate" end end end @@ -782,7 +782,7 @@ describe SystemNoteService, services: true do it 'sets the note text' do spend_time!(277200) - expect(subject.note).to eq "Added 1w 4d 5h of time spent on this merge request" + expect(subject.note).to eq "added 1w 4d 5h of time spent" end end @@ -790,7 +790,7 @@ describe SystemNoteService, services: true do it 'sets the note text' do spend_time!(-277200) - expect(subject.note).to eq "Subtracted 1w 4d 5h of time spent on this merge request" + expect(subject.note).to eq "subtracted 1w 4d 5h of time spent" end end @@ -798,7 +798,7 @@ describe SystemNoteService, services: true do it 'sets the note text' do spend_time!(:reset) - expect(subject.note).to eq "Removed time spent on this merge request" + expect(subject.note).to eq "removed time spent" end end From ab92e02503b79e7e11dffeb69d505a9049f83f3d Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Mon, 6 Feb 2017 11:45:21 -0200 Subject: [PATCH 4/4] Add changelog file --- changelogs/unreleased/pms-lowercase-system-notes.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/pms-lowercase-system-notes.yml diff --git a/changelogs/unreleased/pms-lowercase-system-notes.yml b/changelogs/unreleased/pms-lowercase-system-notes.yml new file mode 100644 index 00000000000..c2fa1a7fad0 --- /dev/null +++ b/changelogs/unreleased/pms-lowercase-system-notes.yml @@ -0,0 +1,4 @@ +--- +title: Make all system notes lowercase +merge_request: 8807 +author: