2018-11-20 20:47:30 +05:30
|
|
|
# frozen_string_literal: true
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Email
|
|
|
|
module Handler
|
2018-11-20 20:47:30 +05:30
|
|
|
def self.handlers
|
|
|
|
@handlers ||= load_handlers
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.load_handlers
|
|
|
|
[
|
|
|
|
CreateNoteHandler,
|
2020-05-24 23:13:21 +05:30
|
|
|
CreateIssueHandler,
|
|
|
|
UnsubscribeHandler,
|
|
|
|
CreateMergeRequestHandler
|
2018-11-20 20:47:30 +05:30
|
|
|
]
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
def self.for(mail, mail_key)
|
2018-11-20 20:47:30 +05:30
|
|
|
handlers.find do |klass|
|
2016-09-13 17:45:13 +05:30
|
|
|
handler = klass.new(mail, mail_key)
|
|
|
|
break handler if handler.can_handle?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
Gitlab::Email::Handler.prepend_if_ee('::EE::Gitlab::Email::Handler')
|