public_link_updates.rb 718 B

12345678910111213141516171819202122
  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. broadcastable true
  6. argument :screen, Gql::Types::Enum::PublicLinksScreenType, required: true, description: 'Subscribe to public links for a specific screen'
  7. field :public_links, [Gql::Types::PublicLinkType], description: 'Current available public links'
  8. def self.authorize(...)
  9. true # This subscription should be available for all (including unauthenticated) users.
  10. end
  11. def update(screen:)
  12. { public_links: PublicLink.select { |link| link[:screen].include?(screen) } }
  13. end
  14. end
  15. end