Commit 552dad1f authored by Sean McGivern's avatar Sean McGivern

Merge branch 'alternate-incoming-mail-address-for-gitlab-com' into 'master'

Allow an alternate incoming email address for GitLab.com

See merge request gitlab-org/gitlab-ee!5225
parents 6f4e81ad 3d822bef
...@@ -52,6 +52,8 @@ module Gitlab ...@@ -52,6 +52,8 @@ module Gitlab
private private
def address_regex def address_regex
return /^incoming\+(.+)@(incoming\.)?gitlab\.com$/ if Gitlab.com?
wildcard_address = config.address wildcard_address = config.address
return nil unless wildcard_address return nil unless wildcard_address
......
...@@ -83,6 +83,25 @@ describe Gitlab::IncomingEmail do ...@@ -83,6 +83,25 @@ describe Gitlab::IncomingEmail do
it "returns reply key" do it "returns reply key" do
expect(described_class.key_from_address("replies+key@example.com")).to eq("key") expect(described_class.key_from_address("replies+key@example.com")).to eq("key")
end end
context "on GitLab.com" do
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
it "returns the reply key when using @gitlab.com" do
expect(described_class.key_from_address("incoming+key@gitlab.com")).to eq("key")
end
it "returns the reply key when using @incoming.gitlab.com" do
expect(described_class.key_from_address("incoming+key@incoming.gitlab.com")).to eq("key")
end
it "does not match other addresses" do
expect(described_class.key_from_address("fooincoming+key@incoming.gitlab.com")).to be_nil
expect(described_class.key_from_address("incoming+key@incoming.gitlab.com.someotherdomain.com")).to be_nil
end
end
end end
context 'self.key_from_fallback_message_id' do context 'self.key_from_fallback_message_id' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment