2020-07-09 09:09:27 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module ServiceDeskEmail
|
|
|
|
class << self
|
2022-11-04 15:07:23 +00:00
|
|
|
include Gitlab::Email::Common
|
|
|
|
|
|
|
|
def config
|
|
|
|
Gitlab.config.service_desk_email
|
2020-07-09 09:09:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def key_from_address(address)
|
|
|
|
wildcard_address = config&.address
|
|
|
|
return unless wildcard_address
|
|
|
|
|
|
|
|
Gitlab::IncomingEmail.key_from_address(address, wildcard_address: wildcard_address)
|
|
|
|
end
|
|
|
|
|
2020-08-12 21:09:54 +00:00
|
|
|
def address_for_key(key)
|
|
|
|
return if config.address.blank?
|
|
|
|
|
2022-11-04 15:07:23 +00:00
|
|
|
config.address.sub(WILDCARD_PLACEHOLDER, key)
|
2022-06-02 09:09:17 +00:00
|
|
|
end
|
2020-07-09 09:09:27 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|