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

service_desk_email.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bc49efafddaa6ae3ee8c55747fd51fb298f06f5e (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
# frozen_string_literal: true

module Gitlab
  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::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