Commit 3d822bef authored by Sean McGivern's avatar Sean McGivern

Allow an alternate incoming email address for GitLab.com

This is temporary, until we switch completely:
https://about.gitlab.com/2018/03/06/reconfigure-inbound-email-for-gitlab-notification/
parent 8ba33b5d
......@@ -52,6 +52,8 @@ module Gitlab
private
def address_regex
return /^incoming\+(.+)@(incoming\.)?gitlab\.com$/ if Gitlab.com?
wildcard_address = config.address
return nil unless wildcard_address
......
......@@ -83,6 +83,25 @@ describe Gitlab::IncomingEmail do
it "returns reply key" do
expect(described_class.key_from_address("replies+key@example.com")).to eq("key")
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
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