2020-07-28 23:09:34 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Email
|
|
|
|
class ServiceDeskReceiver < Receiver
|
|
|
|
private
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
def find_handler
|
|
|
|
return unless service_desk_key
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
Gitlab::Email::Handler::ServiceDeskHandler.new(mail, nil, service_desk_key: service_desk_key)
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
def service_desk_key
|
|
|
|
strong_memoize(:service_desk_key) do
|
|
|
|
find_service_desk_key
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_service_desk_key
|
2020-07-28 23:09:34 +05:30
|
|
|
mail.to.find do |address|
|
|
|
|
key = ::Gitlab::ServiceDeskEmail.key_from_address(address)
|
|
|
|
break key if key
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|