summaryrefslogtreecommitdiff
path: root/app/services/issuable
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2018-12-17 12:35:59 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2018-12-18 08:36:56 +0800
commit9d1090d49b3077a4a785d2f624e60686d0a863e3 (patch)
tree03c48ab832392694cc19be337e591fae718d8bd1 /app/services/issuable
parent8b4602041cf2c4a8738a4796d78720017249249f (diff)
downloadgitlab-ce-9d1090d49b3077a4a785d2f624e60686d0a863e3.tar.gz
Run CommonSystemNotesService on issuable create
Adds system notes for labels, milestone and due date on create
Diffstat (limited to 'app/services/issuable')
-rw-r--r--app/services/issuable/common_system_notes_service.rb21
1 files changed, 12 insertions, 9 deletions
diff --git a/app/services/issuable/common_system_notes_service.rb b/app/services/issuable/common_system_notes_service.rb
index 765de9c66b0..885e14bba8f 100644
--- a/app/services/issuable/common_system_notes_service.rb
+++ b/app/services/issuable/common_system_notes_service.rb
@@ -4,20 +4,23 @@ module Issuable
class CommonSystemNotesService < ::BaseService
attr_reader :issuable
- def execute(issuable, old_labels)
+ def execute(issuable, old_labels: [], is_update: true)
@issuable = issuable
- if issuable.previous_changes.include?('title')
- create_title_change_note(issuable.previous_changes['title'].first)
- end
+ if is_update
+ if issuable.previous_changes.include?('title')
+ create_title_change_note(issuable.previous_changes['title'].first)
+ end
- handle_description_change_note
+ handle_description_change_note
+
+ handle_time_tracking_note if issuable.is_a?(TimeTrackable)
+ create_discussion_lock_note if issuable.previous_changes.include?('discussion_locked')
+ end
- handle_time_tracking_note if issuable.is_a?(TimeTrackable)
- create_labels_note(old_labels) if issuable.labels != old_labels
- create_discussion_lock_note if issuable.previous_changes.include?('discussion_locked')
- create_milestone_note if issuable.previous_changes.include?('milestone_id')
create_due_date_note if issuable.previous_changes.include?('due_date')
+ create_milestone_note if issuable.previous_changes.include?('milestone_id')
+ create_labels_note(old_labels) if issuable.labels != old_labels
end
private