Remove noteable object in time tracking system notes [ci-skip]

This commit is contained in:
Pedro Moreira da Silva 2017-01-26 13:00:32 +00:00 committed by Oswaldo Ferreira
parent ed834c9ff1
commit 5316d1cf45
1 changed files with 8 additions and 8 deletions

View File

@ -118,18 +118,18 @@ module SystemNoteService
# #
# Example Note text: # 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 # 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)
@ -144,9 +144,9 @@ module SystemNoteService
# #
# Example Note text: # 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 # Returns the created Note object
@ -154,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)