debian-mirror-gitlab/lib/gitlab/email/handler.rb

29 lines
566 B
Ruby
Raw Normal View History

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,
2020-07-28 23:09:34 +05:30
CreateMergeRequestHandler,
ServiceDeskHandler
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