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-02-21 18:32:18 -05:00
|
|
|
HANDLERS = [UnsubscribeHandler, CreateNoteHandler, 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
|