Commit 651f923d authored by Douwe Maan's avatar Douwe Maan

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

Resolve "Extract EE specific files/lines for lib/gitlab/email/handler.rb"

Closes #6417

See merge request gitlab-org/gitlab-ee!6975
parents 2554a798 77f60b33
# frozen_string_literal: true
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
# frozen_string_literal: true
module Gitlab module Gitlab
module Email module Email
module Handler module Handler
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Handler::EE::ServiceDeskHandler do describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Handler do describe Gitlab::Email::Handler do
......
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'
require 'gitlab/email/handler/ee/service_desk_handler'
module Gitlab module Gitlab
module Email module Email
module Handler module Handler
HANDLERS = [ prepend ::EE::Gitlab::Email::Handler
EE::ServiceDeskHandler,
UnsubscribeHandler, def self.handlers
CreateNoteHandler, @handlers ||= load_handlers
CreateMergeRequestHandler, end
CreateIssueHandler
].freeze def self.load_handlers
[
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
......
# 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