Consider the following situation:

Bob creates a node. Jill posts a comment, with the "Notify me when new comments are posted" box checked. Bob then posts a comment. Jill receives an email notification. So far so good.

Jill decides to post another comment, but decides that she no longer wants notifications, so she UN-checks the "Notify me when new comments are posted" box. However, she still continues to receive email notifications for that thread!

It appears that if a single comment by a user in a thread was ever submitted with the box checked, the user can't actually unsubscribe from that thread by unchecking the box. In fact, even if the user edits that comment that had the box checked, unchecks the box, and then clicks save, it has no effect. That comment still has a 1 in the notify column of the comment_notify table, and upon editing the comment again, you'll see that the box is still checked (despite having unchecked it and clicked save).

In case it makes a difference, I don't allow replies to specific comments, so all comments are treated as replies to the original post.

Members fund testing for the Drupal project. Drupal Association Learn more


greggles’s picture

Title: Unchecking the "Notify me when new comments are posted" box doesn't work if you previously DID want notifications » Unchecking the "Notify me when new comments are posted" box on a comment doesn't save
Status: Active » Needs review
2.15 KB

I think there's two parts here:

1. The subscription is per comment, not per node. If you have the notification type set to "all comments on this node" then it should stop notifying you if a later comment doesn't have subscription enabled - see #539214: Subscribe/Unsubscribe should be by node, not by comment if the subscription is to all comments for some details on that.
2. Editing a comment and toggling the notification state didn't quite work. I'd like to focus this issue on that. Attached patch fixes a few bugs that show up depending on which notification types are enabled and also fixes a small code style issue.

greggles’s picture

@maxedison could you try out this patch and confirm if it works for you? Thanks!

I'll probably commit it soon even without feedback, but it's always good to get feedback and additional testers.

maxedison’s picture

Sorry, I haven't had a chance to test the patch yet. Hopefully I will get to it later this week. Regarding point #1, however, I guess I don't see how the thread you linked to resolves this. In fact, it seems to point out the same (or at least similar) but I described, but that is for version 6.x, and I'm using 7.x. Furthermore, that bug doesn't seem to have been resolved. Finally, under "Available subscription modes" in my configuration, I only have the box checked for "All comments." Not sure if that's the same thing as setting the notification type to "all comments on this node." I don't see that option anywhere...

greggles’s picture

Title: Unchecking the "Notify me when new comments are posted" box on a comment doesn't save » Unchecking the 'Notify me when new comments are posted' box on a comment doesn't save
Status: Needs review » Fixed

Committed to 7.x - thanks for reporting the problem, maxedison.

Regarding issue #1 and whether this is a duplicate of that: yes, it's true that one is for 6.x and yes, it's true that it's not fixed yet. Those things don't prevent this from being a duplicate ;)

The "Version" is a dropdown, but should probably be checkboxes so we can say that an issue applies to multiple versions. It's also considered standard practice (on and often in other bug queues) to only include 1 "problem" per issue node. Your original description covered two related but different problems so I wanted to split them apart.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.