In Drupal 7, there is an idea of unpublished/published comments. Comments that are unpublished need to be approved before they are visible to general members of the site.
For example, we could allow Anonymous to post comments, but the comments will only show up for users when a site admin has approved them (making them published).
Right now, when unpublished comments are created in reply to a published node, because they are new comments, everyone on the site who has not opted out will be notified about the comment -- even though it is not approved! This should not be the case. No one should be notified of this new comment until it has been approved (or never if it is not approved).
I have attached a patch that fixes this bug. Users will not be notified on the cron run / Execute operation when an unpublished comment is posted. Instead, every time an unpublished comment is created, it is added to a queue. When the cron run / Execute operation is run, we check to see if any unpublished comments in the queue have since been published. If they have, then we notify users (assuming comment notifications are enabled for a given user) and delete the entry from the queue.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | D7_notify_comment_delete.patch | 678 bytes | mark.lindsey |
| D7_notify_unpublished_comment_queue.patch | 6.3 KB | mark.lindsey |
Comments
Comment #1
gisleThanks for the bug report and patch!
Reviewed and looks good. Commited May 12, 2013 15:24 (commit 5408237 on 7.x-1.x branch).
Will show up in the next nightly dev snapshot.
Comment #2
mark.lindsey commentedHi Gisle,
Thanks for the quick feedback and addition to the 7.x-1.x branch.
I found one additional change that should be included as part of this. I accidentally left out a case accounting for when a comment is deleted. If a comment is deleted, then it should be deleted from the notify unpublished comments queue as well. We already have the corresponding cases taken into account when the comment's node is deleted and when the unpublished comment is created.
I have attached this fix as a patch based off of the current 7.x-1.x branch.
Comment #3
gisleThanks for the second patch!
Reviewed and looks good. Commited May 13, 2013 22:26 (commit d8de130 on 7.x-1.x branch).
Will show up in the next nightly dev snapshot.