Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If a node doesn't have any comments, we know this without doing a full pager query to find out.
Comment | File | Size | Author |
---|---|---|---|
#14 | comment_render.patch | 2.06 KB | catch |
#7 | comment_render.patch | 2.23 KB | catch |
#6 | comment_render.patch | 1.95 KB | catch |
#4 | comment_render_revert.patch | 662 bytes | catch |
#3 | comment_render.patch | 1.24 KB | catch |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedGood catch catch.
Comment #2
Dries CreditAttribution: Dries commentedI committed this to CVS HEAD. I believe it should go into DRUPAL-6 but I'll leave that up to Gabor so he can review it once more. Updated the version accordingly. It might need a re-roll for Drupal 6 ...
Comment #3
catchThanks. Re-roll for 6.
Comment #4
catchThis broke comment approval tests - if a node only has one comment, and that comment is unpublished, we no longer render it. We could probably find a way around this like a separate 'has comments' flag to the count one, but for now here's a straight revert. I miss the test bot :(
Comment #5
Dries CreditAttribution: Dries commentedRolled back the patch.
Comment #6
catchThanks Dries.
This gets more interesting.
I fixed the first bug with a user_access('administer comments') check.
However, I then found that the comment 'approve' link bypasses comment_save (as does everything in http://api.drupal.org/api/function/comment_operations/6) - this means that node_comment_statistics never gets updated - so the tests still have one fail without that being fixed.
Also, when manually testing the comment approval, I noticed that the published/unpublished radios are mislabeled. Fun.
So, here's a new patch which both adds the proper checks to avoid the query, and fixes comment_approve() so that tests continue to pass, this bug was hidden due to the lack of the $node->comment_status check but is now covered by the comment approval test.
I've opened issues for the other two bugs at #352911: comment administration form mis-labeling and #352895: comment_operations bypasses comment_save.
comment_save() should also take a properly formatted comment object instead of a fapi array, but there must be an issue for that somewhere already.
Comment #7
catchBetter code comment.
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedWelcome to dark dark world of comment module.
Comment #10
catchComment #11
catchComment #12
moshe weitzman CreditAttribution: moshe weitzman commentedthanks, comment module maintainer :)
Comment #14
catchre-rolled due to a whitespace change. No changes, so leaving RTBC.
Comment #15
webchickCommitted to HEAD, thanks! :)