2017-08-24 02:20:36 -04:00
|
|
|
require 'gitlab/email/handler/create_merge_request_handler'
|
2016-05-21 12:40:08 -04:00
|
|
|
require 'gitlab/email/handler/create_note_handler'
|
|
|
|
require 'gitlab/email/handler/create_issue_handler'
|
2016-10-12 13:07:36 -04:00
|
|
|
require 'gitlab/email/handler/unsubscribe_handler'
|
2016-05-21 12:40:08 -04:00
|
|
|
|
2016-05-18 18:19:25 -04:00
|
|
|
module Gitlab
|
|
|
|
module Email
|
2016-05-21 12:40:08 -04:00
|
|
|
module Handler
|
2017-04-06 14:19:45 -04:00
|
|
|
HANDLERS = [
|
|
|
|
UnsubscribeHandler,
|
|
|
|
CreateNoteHandler,
|
2017-08-24 02:20:36 -04:00
|
|
|
CreateMergeRequestHandler,
|
2017-04-06 14:19:45 -04:00
|
|
|
CreateIssueHandler
|
|
|
|
].freeze
|
2016-06-15 04:31:28 -04:00
|
|
|
|
2016-05-21 12:40:08 -04:00
|
|
|
def self.for(mail, mail_key)
|
2016-06-15 04:31:28 -04:00
|
|
|
HANDLERS.find do |klass|
|
2016-05-21 12:40:08 -04:00
|
|
|
handler = klass.new(mail, mail_key)
|
|
|
|
break handler if handler.can_handle?
|
|
|
|
end
|
2016-05-18 18:19:25 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|