ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

[PATCH] Extensible MailHandler (Feature #170)


Added by Yuki Sonoda at 2011-02-10 08:02 am. Updated at 2011-02-17 01:11 am.


Status:Closed Start date:2011-02-10
Priority:Normal Due date:
Assignee:Eric Davis % Done:

0%

Category:Mail Receiving
Target version:1.1.0 — Bell
Remote issue URL:http://www.redmine.org/issues/7598 Affected version:

Description

app/models/mail_handler is useful but not extensibly from plugins. I think it would be useful if MailHandler were extensible by making a subclass based on it.

I wrote the attached patch. This introduces MailHandler#dispatch_to_default which just calls receive_issue by default. Plugin can extend the dispatch table by overriding #dispatch_to_default.


extensible-mail-handler.patch (913 Bytes) Yuki Sonoda, 2011-02-10 08:02 am


Associated revisions

Revision a47ad014
Added by Eric Davis at 2011-02-15 12:48 am

[#170] Refactor MailHandler to support a default dispatch method

Contributed by Yuki Sonoda

History

Updated by Felix Schäfer at 2011-02-10 09:00 am

Couldn't you currently extend the model and replace/extend #receive_issue with an alias_method_chain?

Updated by Holger Just at 2011-02-10 09:11 am

Felix Schäfer wrote:

Couldn't you currently extend the model and replace/extend #receive_issue with an alias_method_chain?

alias_method_chain is a really hacky solution which is abused with great virtuosity in Redmine/ChiliProject plugins and creates a lot of pain sometimes. So if we have the opportunity to have an actual extensible API, we should really go for it.

Updated by Eric Davis at 2011-02-10 11:43 pm

I also thought about alias_method_chain but if I recall ActionMailer classes do some funky tricks for their methods (partial singleton, class methods...). This makes patching is more difficult.

Having an overall extensible API for mail receiving is actually a great idea. Then plugins can hook into there to process their own email (e.g. like replying to the emails my Question plugin generates). I think Yuki Sonoda's patch is the simplest thing that could work.

  • Status changed from Open to Ready for review

Updated by Eric Davis at 2011-02-14 11:59 pm

I've added Yuki's patch to a branch along with some rdoc comments. Ready for review.

https://github.com/edavis10/chiliproject/tree/ticket/master/170-mail-handler-dispatch

  • Assignee set to Eric Davis

Updated by Felix Schäfer at 2011-02-15 01:34 pm

Looks good to me, merge at will.

Updated by Eric Davis at 2011-02-17 01:11 am

Merged into master for 1.1.0. Thank you for the patch Yuki Sonoda.

  • Target version set to 1.1.0 — Bell
  • Status changed from Ready for review to Closed

Also available in: Atom PDF