Over in #322064: Add comment notifications via e-mail, there are some skipped comments between #44 and #48, which were caused by some dumb-ass spammer. They changed the issue title + tags to say "louis vitton something something", along with adding their spammy body with all the links.

These spam comments were deleted by Drupal admins, which reverted the title automatically. But when I went back to look at that issue, I saw that the spam tags were still there. I removed them all in #48. But what it actually removed were the *original* tags (Favorite-of-Dries, Killer End-User Features), which was nice, because then I was able to add them back in #49.

Anyway, so it sounds like this module is at least partially reverting the tags on deleted comments, but this isn't visible on node view where it kind of counts.

Comments

mr.baileys’s picture

What Comment Alter Taxonomy currently does in hook_comment() on delete operations is removing the comment's "history" record in the {comment_alter_taxonomy} table. No changes are made to the terms assigned to that comment's node, regardless of whether or not the deleted comment made any taxonomy changes. The fact that CAT does not update the node's terms in the event of a deleted comment causes the phantom behavior.

So in your scenario:

  • node has 43 comments, after which terms for the node are "Favorite-of-Dries" and "Killer End-User Features".
  • spammer adds 4 comments, replacing the above terms on the node with "handbags".
  • comments 44-47 are removed by an admin.
    ==> At this point, CAT does some housekeeping in it's own tables, but neglects to update the node and does not revert the terms assigned to the node back to the situation it was in at comment #43.
  • Since the node was not updated during the previous step, the spammer's taxonomy changes are still visible on the node even though the comments adding these terms are no longer present. webchick removes "handbags".
    ==> Webchick's changes to taxonomy (remove handbags) are applied, leaving the node without any terms.
  • webchick re-adds the F-o-D and KEUF.

While this is a fairly easy fix when there are no new comments following the deleted comment(s) (just take the terms stored with the most recent comment and re-apply them to the node), it gets tricky once you start deleting comments that are not at the end of the chain (you'd basically have to "replay" the taxonomy changes made by all comments following the deleted comments and apply the result to the node)

...so it sounds like this module is at least partially reverting the tags on deleted comments...

If my scenario above is correct, then that statement is incorrect: CAT does not revert the tags on the node when deleting a comment. This is shown by the fact that after deleting the comment that did "+handbags -F-o-D -KEUF", you had to manually "-handbags +F-o-D +KEUF". CAT only updates it's own history table, which I think is only used to display the term transitions per comment.