Commit c0625e5d authored by Douwe Maan's avatar Douwe Maan

Merge branch '6417-extract-ee-specific-files-lines-for-lib-gitlab-email-handler-rb' into 'master'

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

See merge request gitlab-org/gitlab-ce!21358
parents 3b7647b0 b07ca92f
require 'gitlab/email/handler/create_merge_request_handler' # frozen_string_literal: true
require 'gitlab/email/handler/create_note_handler'
require 'gitlab/email/handler/create_issue_handler'
require 'gitlab/email/handler/unsubscribe_handler'
module Gitlab module Gitlab
module Email module Email
module Handler module Handler
HANDLERS = [ def self.handlers
@handlers ||= load_handlers
end
def self.load_handlers
[
UnsubscribeHandler, UnsubscribeHandler,
CreateNoteHandler, CreateNoteHandler,
CreateMergeRequestHandler, CreateMergeRequestHandler,
CreateIssueHandler CreateIssueHandler
].freeze ]
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
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Email module Email
module Handler module Handler
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler' require 'gitlab/email/handler/base_handler'
module Gitlab module Gitlab
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler' require 'gitlab/email/handler/base_handler'
require 'gitlab/email/handler/reply_processing' require 'gitlab/email/handler/reply_processing'
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler' require 'gitlab/email/handler/base_handler'
require 'gitlab/email/handler/reply_processing' require 'gitlab/email/handler/reply_processing'
......
# frozen_string_literal: true
module Gitlab module Gitlab
module Email module Email
module Handler module Handler
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler' require 'gitlab/email/handler/base_handler'
module Gitlab module Gitlab
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Handler::CreateIssueHandler do describe Gitlab::Email::Handler::CreateIssueHandler do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Handler::CreateMergeRequestHandler do describe Gitlab::Email::Handler::CreateMergeRequestHandler do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Handler::CreateNoteHandler do describe Gitlab::Email::Handler::CreateNoteHandler do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Handler::UnsubscribeHandler do describe Gitlab::Email::Handler::UnsubscribeHandler do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Handler do describe Gitlab::Email::Handler do
...@@ -40,7 +42,7 @@ describe Gitlab::Email::Handler do ...@@ -40,7 +42,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