update_destination_group_email.rb 506 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. class Service::Channel::Email::UpdateDestinationGroupEmail < Service::Base
  3. attr_reader :group, :channel, :email_address
  4. def initialize(group:, channel:, email_address: nil)
  5. super()
  6. @channel = channel
  7. @group = group
  8. @email_address = email_address || EmailAddress.find_by(channel_id: channel.id)
  9. end
  10. def execute
  11. return if email_address.nil?
  12. group.update!(email_address: email_address)
  13. end
  14. end