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

30 lines
642 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
2019-12-04 20:38:33 +05:30
prepend_if_ee('::EE::Gitlab::Email::Handler') # rubocop: disable Cop/InjectEnterpriseEditionModule
2018-11-20 20:47:30 +05:30
def self.handlers
@handlers ||= load_handlers
end
def self.load_handlers
[
UnsubscribeHandler,
CreateNoteHandler,
CreateMergeRequestHandler,
CreateIssueHandler
]
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