triggers_subscriptions.rb 418 B

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