In D6, the integration between tracker2 and flag was two-way:

  1. If you flagged something, it got added to your tracker.
  2. If you added something to your tracker (created a node, added a comment) it was automatically flagged as "Following".

Right now, flag_tracker handles 1 but not 2. :( I warned about this at the very top of #1560010: [META] Port issue following functionality to D7 but apparently that got lost in the shuffle. I guess we can just implement these hooks:

hook_node_insert()
hook_node_update()
hook_comment_update()
hook_comment_publish()
hook_comment_unpublish()

and notice when nodes are about to be added/removed from tracker and (un)flag them ourselves (assuming all the right configuration conditions are met).

CommentFileSizeAuthor
#2 1828658-2.auto-flag.patch1.98 KBdww

Comments

dww’s picture

Title: Nodes are not auto-flagged when added to the tracker » Nodes are not auto-(un)flagged when added to or removed from the tracker

Slightly better title to reflect the fact that we need to unflag stuff in some cases, too.

dww’s picture

Title: Nodes are not auto-(un)flagged when added to or removed from the tracker » Nodes are not auto-flagged when added to the tracker
Assigned: Unassigned » dww
Status: Active » Needs review
StatusFileSize
new1.98 KB

Upon further consideration (and studying of the flag + tracker2 integration in D6) I realized that we don't actually want to unflag a whole node just because a single comment was deleted or unpublished. In fact, we basically never want to automatically unflag. flag.module itself will remove all the flags once the node is deleted. And it's too much trouble (and too risky) to try to figure out if we should unflag just b/c a given comment was unpublished or removed.

So, I'm re-titling this issue again as I originally had it. ;)

Here's a patch that works well in my local testing. Writing this also helped me understand the bug at #1792912: if you unfollow an issue you created, when it is updated, you end up following it again so I fixed that behavior in here (see the code comments and code for flag_tracker_node_update() for more).

dww’s picture

Status: Needs review » Fixed

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

Anonymous’s picture

Issue summary: View changes

added missing ol tags