Commit 6cad4b0b authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-new-issue-mail-when-service-desk-enabled' into 'master'

Fix creating issues by email with Service Desk on

Closes gitlab-ce#31434

See merge request !1743
parents 17a09e91 7e7b25c8
---
title: Fix emailing issues to projects when Service Desk is enabled
merge_request:
author:
...@@ -23,7 +23,7 @@ module Gitlab ...@@ -23,7 +23,7 @@ module Gitlab
private private
def service_desk_key def service_desk_key
return unless mail_key.include?("/") return unless mail_key.include?('/') && !mail_key.include?('+')
mail_key mail_key
end end
......
...@@ -16,14 +16,14 @@ describe Gitlab::Email::Handler, lib: true do ...@@ -16,14 +16,14 @@ describe Gitlab::Email::Handler, lib: true do
allow_any_instance_of(License).to receive(:add_on?).and_call_original allow_any_instance_of(License).to receive(:add_on?).and_call_original
allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(true) allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(true)
expect(handler_for('emails/service_desk.eml', 'service_desk+some/project')).to be_instance_of(Gitlab::Email::Handler::EE::ServiceDeskHandler) expect(handler_for('emails/service_desk.eml', 'some/project')).to be_instance_of(Gitlab::Email::Handler::EE::ServiceDeskHandler)
end end
it 'uses the create issue handler when Service Desk is disabled' do it 'uses no handler when Service Desk is disabled' do
allow_any_instance_of(License).to receive(:add_on?).and_call_original allow_any_instance_of(License).to receive(:add_on?).and_call_original
allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(false) allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(false)
expect(handler_for('emails/service_desk.eml', 'service_desk+some/project')).to be_instance_of(Gitlab::Email::Handler::CreateIssueHandler) expect(handler_for('emails/service_desk.eml', 'some/project')).to be_nil
end end
end end
...@@ -34,14 +34,14 @@ describe Gitlab::Email::Handler, lib: true do ...@@ -34,14 +34,14 @@ describe Gitlab::Email::Handler, lib: true do
allow_any_instance_of(License).to receive(:add_on?).and_call_original allow_any_instance_of(License).to receive(:add_on?).and_call_original
allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(true) allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(true)
expect(handler_for('emails/valid_new_issue.eml', 'incoming+auth_token')).to be_instance_of(Gitlab::Email::Handler::CreateIssueHandler) expect(handler_for('emails/valid_new_issue.eml', 'some/project+auth_token')).to be_instance_of(Gitlab::Email::Handler::CreateIssueHandler)
end end
it 'uses the create issue handler when Service Desk is disabled' do it 'uses the create issue handler when Service Desk is disabled' do
allow_any_instance_of(License).to receive(:add_on?).and_call_original allow_any_instance_of(License).to receive(:add_on?).and_call_original
allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(false) allow_any_instance_of(License).to receive(:add_on?).with('GitLab_ServiceDesk').and_return(false)
expect(handler_for('emails/valid_new_issue.eml', 'incoming+auth_token')).to be_instance_of(Gitlab::Email::Handler::CreateIssueHandler) expect(handler_for('emails/valid_new_issue.eml', 'some/project+auth_token')).to be_instance_of(Gitlab::Email::Handler::CreateIssueHandler)
end end
end end
end end
......
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