triggers_subscriptions.rb 760 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. # Trigger GraphQL subscriptions on ticket article changes.
  3. module Ticket::Article::TriggersSubscriptions
  4. extend ActiveSupport::Concern
  5. included do
  6. after_create_commit :trigger_create_subscriptions
  7. after_update_commit :trigger_update_subscriptions
  8. after_destroy_commit :trigger_destroy_subscriptions
  9. end
  10. private
  11. def trigger_create_subscriptions
  12. Gql::Subscriptions::TicketArticleUpdates.trigger_after_create(self)
  13. end
  14. def trigger_update_subscriptions
  15. Gql::Subscriptions::TicketArticleUpdates.trigger_after_update(self)
  16. end
  17. def trigger_destroy_subscriptions
  18. Gql::Subscriptions::TicketArticleUpdates.trigger_after_destroy(self)
  19. end
  20. end