handles_group.rb 734 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations::Ticket::Concerns::HandlesGroup
  3. extend ActiveSupport::Concern
  4. included do
  5. private
  6. def group_has_email?(input:)
  7. return true if input[:group].blank?
  8. return true if input[:article].blank?
  9. type = input[:article][:type].presence || Setting.get('ui_ticket_create_default_type')
  10. return true if type.exclude?('email')
  11. return true if input[:group].email_address.present?
  12. false
  13. end
  14. def group_has_no_email_error
  15. error_response(
  16. message: __('This group has no email address configured for outgoing communication.'),
  17. field: 'group_id'
  18. )
  19. end
  20. end
  21. end