Class: Issuable::CommonSystemNotesService
- Inherits:
-
BaseProjectService
- Object
- BaseContainerService
- BaseProjectService
- Issuable::CommonSystemNotesService
- Defined in:
- app/services/issuable/common_system_notes_service.rb
Instance Attribute Summary collapse
-
#is_update ⇒ Object
readonly
Returns the value of attribute is_update.
-
#issuable ⇒ Object
readonly
Returns the value of attribute issuable.
Attributes inherited from BaseProjectService
Attributes inherited from BaseContainerService
#container, #current_user, #group, #params, #project
Instance Method Summary collapse
Methods inherited from BaseProjectService
Methods inherited from BaseContainerService
#group_container?, #initialize, #namespace_container?, #project_container?, #project_group, #root_ancestor
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseProjectService
Instance Attribute Details
#is_update ⇒ Object (readonly)
Returns the value of attribute is_update.
5 6 7 |
# File 'app/services/issuable/common_system_notes_service.rb', line 5 def is_update @is_update end |
#issuable ⇒ Object (readonly)
Returns the value of attribute issuable.
5 6 7 |
# File 'app/services/issuable/common_system_notes_service.rb', line 5 def issuable @issuable end |
Instance Method Details
#execute(issuable, old_labels: [], old_milestone: nil, is_update: true) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/issuable/common_system_notes_service.rb', line 7 def execute(issuable, old_labels: [], old_milestone: nil, is_update: true) @issuable = issuable @is_update = is_update # We disable touch so that created system notes do not update # the noteable's updated_at field ApplicationRecord.no_touching do if is_update if issuable.previous_changes.include?('title') create_title_change_note(issuable.previous_changes['title'].first) end handle_description_change_note create_discussion_lock_note if issuable.previous_changes.include?('discussion_locked') end handle_time_tracking_note if issuable.is_a?(TimeTrackable) handle_start_date_or_due_date_change_note create_milestone_change_event(old_milestone) if issuable.previous_changes.include?('milestone_id') create_labels_note(old_labels) if old_labels && issuable.labels != old_labels end end |