2020-07-28 23:09:34 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module ServiceDeskEmail
|
|
|
|
class << self
|
2023-01-13 00:05:48 +05:30
|
|
|
include Gitlab::Email::Common
|
|
|
|
|
|
|
|
def config
|
|
|
|
Gitlab.config.service_desk_email
|
2020-07-28 23:09:34 +05:30
|
|
|
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-10-24 23:57:45 +05:30
|
|
|
def address_for_key(key)
|
|
|
|
return if config.address.blank?
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
config.address.sub(WILDCARD_PLACEHOLDER, key)
|
2022-07-23 23:45:48 +05:30
|
|
|
end
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|