I'm working on setting up mailcomment support, specifically for replying to Tasks from Work Tracker via e-mail.
However, other plugins in Open Atrium could also use Drupal comments and replying via e-mail might be desirable!
This is issue to implement support for mailcomment and Drupal comments on any node type in the OA Mailhandler module.
Code
I'm working on this in the mailcomment-2113257 branch:
http://drupalcode.org/project/oa_mailhandler.git/shortlog/refs/heads/mai...
Other required patches to Open Atrium
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | oa_mailhandler-mailcomment-2113257-8.patch | 20.33 KB | dsnopek |
| #7 | oa_mailhandler-mailcomment-2113257-7.patch | 20.47 KB | dsnopek |
Comments
Comment #1
mpotter commentedYes, I think that would be a great addition to this module.
Be sure to take a look at how the Feeds plugin parses the nid token in the subject line for security purposes. The token is currently supplied by oa_discussion which might not be the correct place for that. We might want to move the security token into oa_core so other plugins can take advantage of it if you make mailhandler more general purpose.
Comment #2
dsnopekGreat, thanks! I'll post a patch here for review when I've got something ready.
Comment #3
dsnopekI've begun working on this in the mailcomment-2113257 branch:
http://drupalcode.org/project/oa_mailhandler.git/shortlog/refs/heads/mai...
This will currently only work for Work Tracker, because no other content types will create messages for comments, even if they are enabled for the content type. Here is a patch to oa_messages to correct that: #2115919: Add 'oa_comment' message type for comments (will be used by oa_mailhandler)
The mailcomment_message_notify module won't work for us because it makes assumptions about the field names. :-( This meant that I had to copy a lot of what it does in hook_mail_alter() into oa_mailhandler. However, we could make the code more generic so that it'll be used for OA Discussion as well!
What do you think of:
oa_mailhandler_mail_alter()rather than as a token in the message object. This way users can accidentally remove it AND we can use it for comments too.oa_mailhandler_mail_alter()for OA Discussion Post too. So, we'll get the subject mangling, "reply above this line" parsing, unified variables for mailcomment_mail and mailbox_mail, etc.See
oa_mailhandler_mail_alter()to get a better idea of what I mean:http://drupalcode.org/project/oa_mailhandler.git/blob/refs/heads/mailcom...
Please let me know what you think!
Comment #4
dsnopekRevision 08f5d90 does the same security token for Drupal comments as is used for OA Discussion, except it's all self contained in OA Mailhandler.
I think I'm going to go ahead and attempt to unify the handling of Drupal comments and OA Discussion and get everything self-contained in OA Mailhandler like I described in comment #3, so that you have something concrete to review. If it turns out that you don't want to go this direction, I can always revert back to revision 08f5d90.
Some more patches to other parts of Open Atrium will be necessary - I'll gather links to them all in the issue description.
Comment #5
mpotter commentedI've committed the patch for the comment message type.
Comment #6
dsnopek@mpotter: Awesome, thanks! That's really the biggest one. The rest will be removing functionality as it gets moved into OA Mailhandler.
Comment #6.0
dsnopekCleaned up issue description and included links to current work!
Comment #6.1
dsnopekAdding another dependent patch.
Comment #6.2
dsnopekAdded another dependent issue.
Comment #7
dsnopekOk! This now ready for review. It completely unifies comment and discussion "reply by email" functionality, and moves everything to be self-contained within the OA Mailhandler module (rather than spread among oa_messages and oa_discussion as well).
You can find the code in the "mailcomment-2113257" branch in Git:
http://drupalcode.org/project/oa_mailhandler.git/shortlog/refs/heads/mai...
(I've attached a patch to make review easier if you prefer to look at patches - however, it'd probably be best to actually merge the branch in Git rather than applying the patch.)
Also, these are the dependent patches (to oa_core and oa_discussion) to allow this to work fully correctly, although it doesn't necessary fail without them - somethings are simply done twice:
Please let me know what you think!
@mpotter: I can do the actual branch merging if you like, I'd just prefer your approval before making such a big change. :-)
Comment #8
dsnopekEr, not that it matters because we'll merge the branch, but I found some cruft while quickly reading through that patch. Here is a new patch with the cruft removed.
Comment #9
mpotter commentedI think this looks good. Go ahead with the branch merge and I'll commit those other patches to oa_core and oa_discussion. Nice job refactoring all of this!
Comment #10
mpotter commentedPatches in #7 have been committed.
Comment #11
dsnopekAwesome, thanks! Merged in revision f6e55a7. :-)
Comment #11.0
dsnopekAdded another dependent patch.