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 Email
module Handler
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Email::Handler do
......
require 'gitlab/email/handler/create_merge_request_handler'
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'
# frozen_string_literal: true
module Gitlab
module Email
module Handler
HANDLERS = [
EE::ServiceDeskHandler,
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
].freeze
prepend ::EE::Gitlab::Email::Handler
def self.handlers
@handlers ||= load_handlers
end
def self.load_handlers
[
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
]
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
......
# frozen_string_literal: true
module Gitlab
module Email
module Handler
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler'
module Gitlab
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler'
require 'gitlab/email/handler/reply_processing'
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler'
require 'gitlab/email/handler/reply_processing'
......
# frozen_string_literal: true
module Gitlab
module Email
module Handler
......
# frozen_string_literal: true
require 'gitlab/email/handler/base_handler'
module Gitlab
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Email::Handler::CreateIssueHandler do
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Email::Handler::CreateMergeRequestHandler do
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Email::Handler::CreateNoteHandler do
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Email::Handler::UnsubscribeHandler do
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Email::Handler do
......@@ -40,7 +42,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