triggers_subscriptions.rb 549 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Checklist::TriggersSubscriptions
  3. extend ActiveSupport::Concern
  4. included do
  5. after_commit :trigger_ticket_checklist_subscriptions
  6. end
  7. private
  8. def trigger_ticket_checklist_subscriptions
  9. Gql::Subscriptions::Ticket::ChecklistUpdates.trigger(
  10. # Trigger with an empty object in case the checklist was deleted.
  11. destroyed? ? nil : self,
  12. arguments: {
  13. ticket_id: Gql::ZammadSchema.id_from_object(ticket),
  14. }
  15. )
  16. end
  17. end