Skip to content
Snippets Groups Projects
Commit 3ced5ae6 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Save the list of handlers in a constant

parent 5608e1a1
No related branches found
No related tags found
1 merge request!3363Implement #3243 New Issue by email
Loading
@@ -4,8 +4,10 @@ require 'gitlab/email/handler/create_issue_handler'
Loading
@@ -4,8 +4,10 @@ require 'gitlab/email/handler/create_issue_handler'
module Gitlab module Gitlab
module Email module Email
module Handler module Handler
HANDLERS = [CreateNoteHandler, CreateIssueHandler]
def self.for(mail, mail_key) def self.for(mail, mail_key)
[CreateNoteHandler, CreateIssueHandler].find do |klass| HANDLERS.find do |klass|
handler = klass.new(mail, mail_key) handler = klass.new(mail, mail_key)
break handler if handler.can_handle? break handler if handler.can_handle?
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment