checklist_updates.rb 831 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Subscriptions
  3. class Ticket::ChecklistUpdates < BaseSubscription
  4. description 'Subscription for ticket checklist changes.'
  5. argument :ticket_id, GraphQL::Types::ID, description: 'Ticket identifier'
  6. field :ticket_checklist, Gql::Types::ChecklistType, description: 'Ticket checklist'
  7. field :removed_ticket_checklist, Boolean, description: 'Ticket checklist was removed from ticket'
  8. def authorized?(ticket_id:)
  9. context.current_user.permissions?('ticket.agent') && Gql::ZammadSchema.authorized_object_from_id(ticket_id, type: ::Ticket, user: context.current_user)
  10. end
  11. def update(ticket_id:)
  12. return { removed_ticket_checklist: true } if object.nil?
  13. { ticket_checklist: object }
  14. end
  15. end
  16. end