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

Class used to create the even synthetic note If the event does not require a synthetic note the method must return false

Raises:

  • (NoMethodError)


36
37
38
39
40
41
# File 'app/models/concerns/work_item_resource_event.rb', line 36

def synthetic_note_class
  raise NoMethodError, "    `\#{self.class.name}#synthetic_note_class` method must be implemented\n    (return nil if event does not require a note)\n  MESSAGE\nend\n".squish

#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
31
32
# File 'app/models/concerns/work_item_resource_event.rb', line 22

def work_item_synthetic_system_note(events: nil)
  return unless synthetic_note_class

  # 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