taskbar_item_updates.rb 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Subscriptions
  3. class User::Current::TaskbarItemUpdates < BaseSubscription
  4. description 'Changes to the list of taskbar items of the currently logged-in user'
  5. subscription_scope :current_user_id
  6. argument :app, Gql::Types::Enum::TaskbarAppType, description: 'Filter by app'
  7. field :add_item, Gql::Types::User::TaskbarItemType, description: 'A new taskbar item needs to be added to the list'
  8. field :update_item, Gql::Types::User::TaskbarItemType, description: 'An existing taskbar item was changed'
  9. field :remove_item, GraphQL::Types::ID, description: 'An item must be removed from the list'
  10. class << self
  11. def trigger_after_create(item)
  12. pull_trigger(item, { add_item: item })
  13. end
  14. def trigger_after_update(item)
  15. pull_trigger(item, { update_item: item })
  16. end
  17. def trigger_after_destroy(item)
  18. pull_trigger(item, { remove_item: Gql::ZammadSchema.id_from_object(item) })
  19. end
  20. def pull_trigger(item, payload)
  21. trigger(payload, arguments: { app: item.app }, scope: item.user_id)
  22. end
  23. end
  24. def update(app:)
  25. object
  26. end
  27. end
  28. end