2016-09-13 17:45:13 +05:30
|
|
|
require 'gitlab/email/handler/create_note_handler'
|
|
|
|
require 'gitlab/email/handler/create_issue_handler'
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'gitlab/email/handler/unsubscribe_handler'
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Email
|
|
|
|
module Handler
|
2017-08-17 22:00:37 +05:30
|
|
|
HANDLERS = [
|
|
|
|
UnsubscribeHandler,
|
|
|
|
CreateNoteHandler,
|
|
|
|
CreateIssueHandler
|
|
|
|
].freeze
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
def self.for(mail, mail_key)
|
|
|
|
HANDLERS.find do |klass|
|
|
|
|
handler = klass.new(mail, mail_key)
|
|
|
|
break handler if handler.can_handle?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|