set_notification_configuration.rb 910 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Channel::Email::SetNotificationConfiguration < Channel::Email::BaseConfiguration
  4. description 'Set confioguration for sending system notification emails'
  5. argument :outbound_configuration, Gql::Types::Input::Channel::Email::OutboundConfigurationInputType, description: 'Configuration to validate'
  6. field :success, Boolean, description: 'Was the operation successful?'
  7. def ready?(...)
  8. raise Exceptions::Forbidden if Setting.get('system_online_service')
  9. true
  10. end
  11. def resolve(outbound_configuration:)
  12. Service::System::SetEmailNotificationConfiguration
  13. .new(
  14. adapter: outbound_configuration.adapter,
  15. new_configuration: outbound_configuration.to_h.except(:adapter)
  16. ).execute
  17. { success: true }
  18. end
  19. end
  20. end