Welcome to mirror list, hosted at ThFree Co, Russian Federation.

service_desk_email.rb « email « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4ea1c077327c395fb3554d53473640b28cf4c4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Gitlab
  module Email
    module ServiceDeskEmail
      class << self
        include Gitlab::Email::Common

        def config
          Gitlab.config.service_desk_email
        end

        def key_from_address(address)
          wildcard_address = config&.address
          return unless wildcard_address

          Gitlab::Email::IncomingEmail.key_from_address(address, wildcard_address: wildcard_address)
        end

        def address_for_key(key)
          return if config.address.blank?

          config.address.sub(WILDCARD_PLACEHOLDER, key)
        end
      end
    end
  end
end