Commit 37d8f324 authored by Sean McGivern's avatar Sean McGivern

Extract EE-specific lines from Gitlab::Email::Handler

parent fdaeeec0
require 'gitlab/email/handler/ee/service_desk_handler'
module EE
module Gitlab
module Email
module Handler
extend ActiveSupport::Concern
class_methods do
extend ::Gitlab::Utils::Override
override :load_handlers
def load_handlers
[
::Gitlab::Email::Handler::EE::ServiceDeskHandler,
*super
]
end
end
end
end
end
end
......@@ -3,21 +3,28 @@ require 'gitlab/email/handler/create_note_handler'
require 'gitlab/email/handler/create_issue_handler'
require 'gitlab/email/handler/unsubscribe_handler'
require 'gitlab/email/handler/ee/service_desk_handler'
require 'ee/gitlab/email/handler'
module Gitlab
module Email
module Handler
HANDLERS = [
EE::ServiceDeskHandler,
prepend ::EE::Gitlab::Email::Handler
def self.handlers
@handlers ||= load_handlers
end
def self.load_handlers
[
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
].freeze
]
end
def self.for(mail, mail_key)
HANDLERS.find do |klass|
handlers.find do |klass|
handler = klass.new(mail, mail_key)
break handler if handler.can_handle?
end
......
......@@ -40,7 +40,7 @@ describe Gitlab::Email::Handler do
end
def ce_handlers
@ce_handlers ||= Gitlab::Email::Handler::HANDLERS.reject do |handler|
@ce_handlers ||= Gitlab::Email::Handler.handlers.reject do |handler|
handler.name.start_with?('Gitlab::Email::Handler::EE::')
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