diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 18:09:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 18:09:10 +0000 |
commit | 33795139ea8e72756bee3675b4e16387425e6ab1 (patch) | |
tree | 3ca568fca61482e57810ee30ad5ce4b964a82c4e /app/services/issuable/common_system_notes_service.rb | |
parent | c7e385e282bcb8505589bce526e692b7bb819ffa (diff) | |
download | gitlab-ce-33795139ea8e72756bee3675b4e16387425e6ab1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/issuable/common_system_notes_service.rb')
-rw-r--r-- | app/services/issuable/common_system_notes_service.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/app/services/issuable/common_system_notes_service.rb b/app/services/issuable/common_system_notes_service.rb index 846b881e819..c53e19c922a 100644 --- a/app/services/issuable/common_system_notes_service.rb +++ b/app/services/issuable/common_system_notes_service.rb @@ -22,13 +22,17 @@ module Issuable end create_due_date_note if issuable.previous_changes.include?('due_date') - create_milestone_note if issuable.previous_changes.include?('milestone_id') + create_milestone_note if has_milestone_changes? create_labels_note(old_labels) if old_labels && issuable.labels != old_labels end end private + def has_milestone_changes? + issuable.previous_changes.include?('milestone_id') + end + def handle_time_tracking_note if issuable.previous_changes.include?('time_estimate') create_time_estimate_note @@ -95,7 +99,16 @@ module Issuable end def create_milestone_note - SystemNoteService.change_milestone(issuable, issuable.project, current_user, issuable.milestone) + if milestone_changes_tracking_enabled? + # Creates a synthetic note + ResourceEvents::ChangeMilestoneService.new(resource: issuable, user: current_user).execute + else + SystemNoteService.change_milestone(issuable, issuable.project, current_user, issuable.milestone) + end + end + + def milestone_changes_tracking_enabled? + ::Feature.enabled?(:track_resource_milestone_change_events, issuable.project) end def create_due_date_note |