diff options
author | Stan Hu <stanhu@gmail.com> | 2018-09-10 00:19:05 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-09-10 00:19:05 +0300 |
commit | 30227f8e8c277f755ac691d7705e503848f76395 (patch) | |
tree | bae4080362ef99c1cc455d1c9af2dfe2d3a21639 /app/services/system_note_service.rb | |
parent | 3fe14f935ca7b68585c6df5458d2070bbff051f7 (diff) | |
parent | 997dda50f4567cf218df80c0fd5fe64afb18bf2e (diff) |
Merge branch '38208-due-dates-system-notes' into 'master'
Add system note when due date is changed
Closes #38208
See merge request gitlab-org/gitlab-ce!21628
Diffstat (limited to 'app/services/system_note_service.rb')
-rw-r--r-- | app/services/system_note_service.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 3ea81445798..c5d05992575 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -119,6 +119,26 @@ module SystemNoteService create_note(NoteSummary.new(noteable, project, author, body, action: 'milestone')) end + # Called when the due_date of a Noteable is changed + # + # noteable - Noteable object + # project - Project owning noteable + # author - User performing the change + # due_date - Due date being assigned, or nil + # + # Example Note text: + # + # "removed due date" + # + # "changed due date to September 20, 2018" + # + # Returns the created Note object + def change_due_date(noteable, project, author, due_date) + body = due_date ? "changed due date to #{due_date.to_s(:long)}" : 'removed due date' + + create_note(NoteSummary.new(noteable, project, author, body, action: 'due_date')) + end + # Called when the estimated time of a Noteable is changed # # noteable - Noteable object |