Commit e2be4012 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'reorder-email-handlers' into 'master'

Reorder Email Handlers based on traffic pattern

See merge request gitlab-org/gitlab!31243
parents 0e828863 5e0f157c
......@@ -12,8 +12,8 @@ module EE
override :load_handlers
def load_handlers
[
::Gitlab::Email::Handler::EE::ServiceDeskHandler,
*super
*super,
::Gitlab::Email::Handler::EE::ServiceDeskHandler
]
end
end
......
......@@ -9,10 +9,10 @@ module Gitlab
def self.load_handlers
[
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
CreateIssueHandler,
UnsubscribeHandler,
CreateMergeRequestHandler
]
end
......
......@@ -6,6 +6,18 @@ describe Gitlab::Email::Handler do
let(:email) { Mail.new { body 'email' } }
describe '.for' do
context 'key matches the reply_key of a notification' do
it 'picks note handler' do
expect(described_class.for(email, '1234567890abcdef1234567890abcdef')).to be_an_instance_of(Gitlab::Email::Handler::CreateNoteHandler)
end
end
context 'key matches the reply_key of a notification, along with an unsubscribe suffix' do
it 'picks unsubscribe handler' do
expect(described_class.for(email, '1234567890abcdef1234567890abcdef-unsubscribe')).to be_an_instance_of(Gitlab::Email::Handler::UnsubscribeHandler)
end
end
it 'picks issue handler if there is no merge request prefix' do
expect(described_class.for(email, 'project+key')).to be_an_instance_of(Gitlab::Email::Handler::CreateIssueHandler)
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