Module: Gitlab::ServiceDeskEmail

Defined in:
lib/gitlab/service_desk_email.rb

Class Method Summary collapse

Class Method Details

.address_for_key(key) ⇒ Object


21
22
23
24
25
# File 'lib/gitlab/service_desk_email.rb', line 21

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

  config.address.sub(Gitlab::IncomingEmail::WILDCARD_PLACEHOLDER, key)
end

.configObject


17
18
19
# File 'lib/gitlab/service_desk_email.rb', line 17

def config
  Gitlab.config.service_desk_email
end

.enabled?Boolean

Returns:

  • (Boolean)

6
7
8
# File 'lib/gitlab/service_desk_email.rb', line 6

def enabled?
  !!config&.enabled && config&.address.present?
end

.key_from_address(address) ⇒ Object


10
11
12
13
14
15
# File 'lib/gitlab/service_desk_email.rb', line 10

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

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