triggers_subscriptions.rb 547 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. # Trigger GraphQL subscriptions on public link changes.
  3. module PublicLink::TriggersSubscriptions
  4. extend ActiveSupport::Concern
  5. included do
  6. after_create :trigger_subscriptions
  7. after_update :trigger_subscriptions
  8. after_destroy :trigger_subscriptions
  9. end
  10. private
  11. def trigger_subscriptions
  12. PublicLink::AVAILABLE_SCREENS.each do |screen|
  13. Gql::Subscriptions::PublicLinkUpdates.trigger(nil, arguments: { screen: screen })
  14. end
  15. end
  16. end