change_visibility.rb 782 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Ticket::Article::ChangeVisibility < BaseMutation
  4. description 'Change ticket article visibility from public to internal or vice versa'
  5. argument :article_id, GraphQL::Types::ID, loads: Gql::Types::Ticket::ArticleType, description: 'The article to be updated'
  6. argument :internal, Boolean, description: 'Target visibility'
  7. field :article, Gql::Types::Ticket::ArticleType, description: 'The updated ticket article'
  8. def resolve(article:, internal:)
  9. article = Service::Ticket::Article::ChangeVisibility
  10. .new(current_user: context.current_user)
  11. .execute(article: article, internal: internal)
  12. { article: article }
  13. end
  14. end
  15. end