Closed (works as designed)
Project:
Flag
Version:
7.x-3.5
Component:
Actions integration
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jul 2014 at 22:15 UTC
Updated:
25 Jul 2014 at 20:35 UTC
Jump to comment: Most recent
Comments
Comment #1
joachim commentedI don't think the action for unpublishing comments is Flag's responsibility...?
Comment #2
coolestdude1 commentedjoachim, flags can have actions on comments and one of those actions is to set the published status of said comments. The process works great for unpublishing comments but the count of these comments are stored in a different table as aggregate data for a node. Views reads from that statistics table rather than counting the number of comments every single time. Since flag module adds the flag I do believe this issue originates from flag_actions since the process happens correctly except for the statistics update.
Essentially I had to implement this code to get around this issue but it should just be patched from within flag_actions
Once implemented comment count numbers return to normal.
Comment #3
joachim commentedI'm not sure it's Flag's responsibility to do Comment module's housekeeping! Furthermore, _comment_update_node_statistics() is prefixed with an underscore, which in Drupal convention means it should be considered private to that module. So we shouldn't be calling it.
What I reckon should be happening is that unpublishing a comment should take care of calling _comment_update_node_statistics(), internally to Comment module.
Comment #4
coolestdude1 commentedFair enough, do you want to push this into the comments queue? I am not exactly sure how the action gets triggered from the comments module perspective, that would also mean moderating comments from the core perceptive doesn't work unless you are just approving a comment.
Comment #5
joachim commentedYup, though probably best if you file a new issue.
The problem is the comment action callback:
https://api.drupal.org/api/drupal/modules!comment!comment.module/functio...
It's changing the database directly. It shouldn't do that; it should use Comment module's own API. At a push, if it really has to go direct to the database, it needs to perform its own housekeeping, as we certainly can't call its private functions, and it would be unreasonable of us to call its housekeeping functions in our actions event, on the mere offchance that the site might be configured to unpublish or publish a comment.
Comment #6
joachim commentedArgh, I meant 'works as designed', since the problem is elsewhere.
Comment #7
coolestdude1 commentedThanks joachim I will follow up with them.
Comment #8
coolestdude1 commentedLink to follow up issue for those with similar issues #2309957