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
This commit is contained in:
commit
c0625e5de1
12 changed files with 37 additions and 12 deletions
|
@ -1,20 +1,23 @@
|
|||
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'
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Gitlab
|
||||
module Email
|
||||
module Handler
|
||||
HANDLERS = [
|
||||
UnsubscribeHandler,
|
||||
CreateNoteHandler,
|
||||
CreateMergeRequestHandler,
|
||||
CreateIssueHandler
|
||||
].freeze
|
||||
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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Gitlab
|
||||
module Email
|
||||
module Handler
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'gitlab/email/handler/base_handler'
|
||||
|
||||
module Gitlab
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'gitlab/email/handler/base_handler'
|
||||
require 'gitlab/email/handler/reply_processing'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'gitlab/email/handler/base_handler'
|
||||
require 'gitlab/email/handler/reply_processing'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Gitlab
|
||||
module Email
|
||||
module Handler
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'gitlab/email/handler/base_handler'
|
||||
|
||||
module Gitlab
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::Email::Handler::CreateIssueHandler do
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::Email::Handler::CreateMergeRequestHandler do
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::Email::Handler::CreateNoteHandler do
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::Email::Handler::UnsubscribeHandler do
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# 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
|
||||
|
|
Loading…
Reference in a new issue