The code to send an email to the node author checks 'node_notify_mailalert' which is never set. Additionally, this code checks agains the current user UID instead of the UID attached to the comment. The result is that this email is never actually sent.
The code to send an email to the commenters passes the current user instead of the user who will actually get the alert to the token module. As a result the email always has the wrong user information available as tokens.
The code that implements hook_tokens never actually returns the replacements. As a result, the unsubscribe URL never gets output properly.
Patch is ready, just posting this first to get the issue ID for the filename.
Comments
Comment #1
rwohlebComment #2
rwohlebOops, looks like my token fix in this patch is already being addressed in #952072: [comment:unsubscribe-url] is not working (and a few other token issues).
Comment #3
trillex commentedFails when patching.
Comment #4
rwohlebThe patch was made from a git clone of the 7.x-1.x branch yesterday. I used the instructions found at http://drupal.org/node/23158/git-instructions for this module.
Comment #5
rwohlebI need to re-roll this patch to remove the token fixes as that is being handled in #952072: [comment:unsubscribe-url] is not working (and a few other token issues). I'm changing the title to reflect this just as an issue with the node author email handling.
Comment #6
rwohlebComment #7
rwohlebHere is the re-rolled patch.
Comment #8
David_Rothstein commentedMarking as a duplicate of #974338: Undefined property 'node_notify_mailalert', and node author never gets a notification since that issue is older and already has a patch that's ready to go and which solves the bug.
Regarding this patch, I don't think it necessarily make sense to switch $user->uid to $comment->uid... because if an administrator is the node author and is editing someone else's comment (e.g. to publish/approve it) they probably don't want to get an email about it, right?
Comment #9
rwohlebDavid_Rothstein, I understand what you mean about admins, but I think that leaving it as a check against $user is counter-intuitive. If I were to add/modify a comment programmatically, then I would expect it to operate around the comment author rather than the current user. Correct me if I'm wrong, but as it is now if a rule/trigger/action is fired off under the current user, it will look at THAT user as the current commenter even if they aren't. For consistency reasons, I'd say that changing it makes more sense.
Comment #10
David_Rothstein commentedInteresting point, though if a comment is being edited programmatically I would think either the node author should always be notified or never at all (depending on what kind of edit it is); i.e., even if they are the comment author, if they didn't type in the changes themselves they might want to know about it, unless it is some kind of unimportant bulk edit.
The problem there is that Drupal doesn't really have a great way to distinguish between programmatic updates and others.