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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
605 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,
2021-03-08 18:12:59 +05:30
CreateNoteOnIssuableHandler,
2020-05-24 23:13:21 +05:30
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