From a47ad014f9c565f7f26debbbb6366f249ad47d5f Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 14 Feb 2011 15:48:18 -0800 Subject: [PATCH 1/2] [#170] Refactor MailHandler to support a default dispatch method Contributed by Yuki Sonoda --- app/models/mail_handler.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 1410a609..e509d091 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -100,7 +100,7 @@ class MailHandler < ActionMailer::Base elsif m = email.subject.match(MESSAGE_REPLY_SUBJECT_RE) receive_message_reply(m[1].to_i) else - receive_issue + dispatch_to_default end rescue ActiveRecord::RecordInvalid => e # TODO: send a email to the user @@ -113,6 +113,10 @@ class MailHandler < ActionMailer::Base logger.error "MailHandler: unauthorized attempt from #{user}" if logger false end + + def dispatch_to_default + receive_issue + end # Creates a new issue def receive_issue From 151a142c447323625ba58ba86d14e211818df5e9 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 14 Feb 2011 15:50:22 -0800 Subject: [PATCH 2/2] Add some rdocs to MailHandler#dispatch_to_default --- app/models/mail_handler.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index e509d091..14db8b80 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -114,6 +114,10 @@ class MailHandler < ActionMailer::Base false end + # Dispatch the mail to the default method handler, receive_issue + # + # This can be overridden or patched to support handling other incoming + # email types def dispatch_to_default receive_issue end