On large site with a large number of comments attached in the day, quickly filled all the notifications. And for users to send hundreds of letters from popular topics. This is very annoying.

This patch changes the structure of sending messages. Firstly it is not send messages to unactive users. Next check the last time was to send a message and if the user has not visited this node yet, the new message he can not send.

The last time the sending message will be stored in {watcher_nodes}.added.

Comments

rbogdan’s picture

StatusFileSize
new3.95 KB

Set {watcher_nodes}.added in past.

skizzo’s picture

Title: Changes in the mechanism of sending messages. » Changes in the mechanism of sending messages (multiple comments, one notification)

Subscribing. Update title to better reflect the feature.
See also old discussions http://drupal.org/node/254485
and http://drupal.org/node/937902
Thank you @rbogdan

rbogdan’s picture

Status: Patch (to be ported) » Needs work

This patch not working properly. It fix problem with send many letters to user. But many valid letters not send. Needs work on this patch.

diego.pasc’s picture

subscrive

what about the status of this very useful patch?

mr.j’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Assigned: rbogdan » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new9.74 KB

Please use the next patch in #6 as this one has a bug.

The patch in #1 never worked properly. It doesn't account for users that don't have an entry in the history table, which has items older than 30 days deleted every cron run. Also if a user visits a node then clicks the watch link on the page, the "added" date will be later than the history timestamp so they won't be notified next time someone posts a comment. And finally it updates the notification date for a user without confirming that the notification was ever queued successfully.

I believe I've fixed all that with this patch. I ran with rbogdan's idea of repurposing the otherwise useless "added" column in the watcher_nodes table to act as a date of last notification. It does the following:

- Sends notifications to users whose date of last notification is before the "last viewed" timestamp in the history table for that node and user (if it exists).
- If there is no record in the history table for the user/nid combo (i.e. user has not visited the node for over 30 days), it will queue a notification only if the date of last notification is more than 30 days ago. This means that a user who never responds and views a node will be emailed a notification every 30 days. I find this an acceptable compromise. YMMV of course.
- Updates the last notification date for each user/node combination after the notifications are successfully queued.
- It does not notify blocked users, as per #848914: Should not be emailing blocked users

mr.j’s picture

StatusFileSize
new9.53 KB

This one works better. The previous patch had a bug around the use of Drupal's NODE_NEW_LIMIT constant.

I have been using this on a site for a week now and I'm happy with the results.