When an email is received, if it has a comment command, or the mailhandler mailbox is configured to add a comment command and the message is a reply to another node (i.e., it is a comment) the body of the new message is replaced with the comment command number.
For example, the mailhandler mailbox is configured to add the following commands to all messages received.
type: forum
tid: 1
published: 1
comment: 2When a message is received that has a parent (it is a reply to an existing node), the message is created as a comment to that parent node. The subject of the comment is the same as that of the email, but the body of the comment is "2".
The problem is this line.
if (!$node->comment) $node->comment = $node->body;
Commands are added to $node and this command conflicts with the comment field of nodes. However, since this function only deals with comments it seems safe to remove that test entirely.
Here's a patch which removes the test and always assigns the body to comment. Ideally, commands would not be assigned to $node, or perhaps would have a prefix added to their key so they could not conflict with table field names.
| Comment | File | Size | Author |
|---|---|---|---|
| mailhandler.comment.patch | 714 bytes | tangent |
Comments
Comment #1
moshe weitzman commentednot sure i like this fix. a module might have created its won custom body in hook_mailhandler. can you think of a different solution?
Comment #2
moshe weitzman commentedComment #3
tangent commentedThis issue appears to still exist.
Short of renaming the 'Comment' command, the only other solution that comes to mind is to add a prefix to all commands in mailhandler_process_message().
Comment #4
killes@www.drop.org commentedI agree it is a problem. We should trat both the title and comment field in an equal way, though.
Comment #5
tng@neuralgourmet.com commentedI'm seeing this in the latest version of Mailhandler. I changed the problem line to:
if (!$node->comment or preg_match('/^\d$/', $node->comment)) $node->comment = $node->body;per this patch.
That seems to have taken care of the problem quite nicely, but it's a bit of an ugly solution.
Comment #6
cor3huis commentedAs I can see form code
...
if (!$node->subject) $node->subject = $node->title;
// When submitting comments, 'comment' means actualy the comment's body, and not the comments status for a node.
// We need to reset the comment's body, so it doesn't colide with a default 'comment' command.
$node->comment = $node->body;
...
it is fixed in current release already.
Thanks for the extensive and good bug report, super!