triggers_subscriptions.rb 456 B

12345678910111213141516
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. # Trigger GraphQL subscriptions on user changes.
  3. module OnlineNotification::TriggersSubscriptions
  4. extend ActiveSupport::Concern
  5. included do
  6. after_commit :trigger_subscriptions
  7. end
  8. def trigger_subscriptions
  9. Gql::Subscriptions::OnlineNotificationsCount
  10. .trigger(user,
  11. arguments: { user_id: Gql::ZammadSchema.id_from_object(user) })
  12. end
  13. end