Module: WorkItemResourceEvent

Extended by:
ActiveSupport::Concern
Included in:
ResourceEvent
Defined in:
app/models/concerns/work_item_resource_event.rb

Instance Method Summary collapse

Instance Method Details

#synthetic_note_classObject

Raises:

  • (NoMethodError)


32
33
34
# File 'app/models/concerns/work_item_resource_event.rb', line 32

def synthetic_note_class
  raise NoMethodError, 'must implement `synthetic_note_class` method'
end

#trigger_note_subscription_create(events: self) ⇒ Object

System notes are not updated or deleted, so firing just the noteCreated event.



18
19
20
# File 'app/models/concerns/work_item_resource_event.rb', line 18

def trigger_note_subscription_create(events: self)
  GraphqlTriggers.work_item_note_created(work_item.to_gid, events)
end

#work_item_synthetic_system_note(events: nil) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'app/models/concerns/work_item_resource_event.rb', line 22

def work_item_synthetic_system_note(events: nil)
  # System notes for label resource events are handled in batches, so that we have single system note for multiple
  # label changes.
  if is_a?(ResourceLabelEvent) && events.present?
    return synthetic_note_class.from_events(events, resource: work_item, resource_parent: work_item.project)
  end

  synthetic_note_class.from_event(self, resource: work_item, resource_parent: work_item.project)
end