Commit 74616ece authored by Sean McGivern's avatar Sean McGivern

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

parent a3382bab
...@@ -6,15 +6,21 @@ require 'gitlab/email/handler/unsubscribe_handler' ...@@ -6,15 +6,21 @@ require 'gitlab/email/handler/unsubscribe_handler'
module Gitlab module Gitlab
module Email module Email
module Handler module Handler
HANDLERS = [ def self.handlers
UnsubscribeHandler, @handlers ||= load_handlers
CreateNoteHandler, end
CreateMergeRequestHandler,
CreateIssueHandler def self.load_handlers
].freeze [
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
]
end
def self.for(mail, mail_key) def self.for(mail, mail_key)
HANDLERS.find do |klass| handlers.find do |klass|
handler = klass.new(mail, mail_key) handler = klass.new(mail, mail_key)
break handler if handler.can_handle? break handler if handler.can_handle?
end end
......
...@@ -40,7 +40,7 @@ describe Gitlab::Email::Handler do ...@@ -40,7 +40,7 @@ describe Gitlab::Email::Handler do
end end
def ce_handlers 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::') handler.name.start_with?('Gitlab::Email::Handler::EE::')
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