Commit 53db7d1d authored by Sean McGivern's avatar Sean McGivern

Merge branch 'pms-lowercase-system-notes' into 'master'

Make all system notes lowercase

See merge request !8807
parents e438b30a ab92e025
...@@ -118,16 +118,18 @@ module SystemNoteService ...@@ -118,16 +118,18 @@ module SystemNoteService
# #
# Example Note text: # Example Note text:
# #
# "Changed estimate of this issue to 3d 5h" # "removed time estimate"
#
# "changed time estimate to 3d 5h"
# #
# Returns the created Note object # Returns the created Note object
def change_time_estimate(noteable, project, author) def change_time_estimate(noteable, project, author)
parsed_time = Gitlab::TimeTrackingFormatter.output(noteable.time_estimate) parsed_time = Gitlab::TimeTrackingFormatter.output(noteable.time_estimate)
body = if noteable.time_estimate == 0 body = if noteable.time_estimate == 0
"Removed time estimate on this #{noteable.human_class_name}" "removed time estimate"
else else
"Changed time estimate of this #{noteable.human_class_name} to #{parsed_time}" "changed time estimate to #{parsed_time}"
end end
create_note(noteable: noteable, project: project, author: author, note: body) create_note(noteable: noteable, project: project, author: author, note: body)
...@@ -142,7 +144,9 @@ module SystemNoteService ...@@ -142,7 +144,9 @@ module SystemNoteService
# #
# Example Note text: # Example Note text:
# #
# "Added 2h 30m of time spent on this issue" # "removed time spent"
#
# "added 2h 30m of time spent"
# #
# Returns the created Note object # Returns the created Note object
...@@ -150,11 +154,11 @@ module SystemNoteService ...@@ -150,11 +154,11 @@ module SystemNoteService
time_spent = noteable.time_spent time_spent = noteable.time_spent
if time_spent == :reset if time_spent == :reset
body = "Removed time spent on this #{noteable.human_class_name}" body = "removed time spent"
else else
parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs) 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}" body = "#{action} #{parsed_time} of time spent"
end end
create_note(noteable: noteable, project: project, author: author, note: body) create_note(noteable: noteable, project: project, author: author, note: body)
...@@ -221,7 +225,7 @@ module SystemNoteService ...@@ -221,7 +225,7 @@ module SystemNoteService
end end
def discussion_continued_in_issue(discussion, project, author, issue) 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 = discussion.reply_attributes.merge(project: project, author: author, note: body)
note_attributes[:type] = note_attributes.delete(:note_type) note_attributes[:type] = note_attributes.delete(:note_type)
......
---
title: Make all system notes lowercase
merge_request: 8807
author:
...@@ -752,13 +752,13 @@ describe SystemNoteService, services: true do ...@@ -752,13 +752,13 @@ describe SystemNoteService, services: true do
it 'sets the note text' do it 'sets the note text' do
noteable.update_attribute(:time_estimate, 277200) 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
end end
context 'without a time estimate' do context 'without a time estimate' do
it 'sets the note text' 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 end
end end
...@@ -782,7 +782,7 @@ describe SystemNoteService, services: true do ...@@ -782,7 +782,7 @@ describe SystemNoteService, services: true do
it 'sets the note text' do it 'sets the note text' do
spend_time!(277200) 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
end end
...@@ -790,7 +790,7 @@ describe SystemNoteService, services: true do ...@@ -790,7 +790,7 @@ describe SystemNoteService, services: true do
it 'sets the note text' do it 'sets the note text' do
spend_time!(-277200) 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
end end
...@@ -798,7 +798,7 @@ describe SystemNoteService, services: true do ...@@ -798,7 +798,7 @@ describe SystemNoteService, services: true do
it 'sets the note text' do it 'sets the note text' do
spend_time!(:reset) 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
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