public_link_updates.rb 694 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Subscriptions
  3. class PublicLinkUpdates < BaseSubscription
  4. description 'Updates to public links'
  5. argument :screen, Gql::Types::Enum::PublicLinksScreenType, required: true, description: 'Subscribe to public links for a specific screen'
  6. field :public_links, [Gql::Types::PublicLinkType], description: 'Current available public links'
  7. def self.authorize(...)
  8. true # This subscription should be available for all (including unauthenticated) users.
  9. end
  10. def update(screen:)
  11. { public_links: PublicLink.select { |link| link[:screen].include?(screen) } }
  12. end
  13. end
  14. end