Problem/Motivation
https://geo.coop/ reported that authenticated users, including site managers, could not see comments, although anonymous visitors could.
This problem was traced to Comment Notify JavaScript:
var radiosHolder = radios.parent().parent();
And the later radiosHolder.hide();
Steps to reproduce
Very likely theme-specific (though that is all available from https://gitlab.com/agaric/sites/geo ).
Proposed resolution
Target a class or ID (more) directly rather than using parent().parent()
Remaining tasks
- ✅ Create merge request fixing bug
- ✅ Test
- ❌ Code review
User interface changes
None, except that GEO.coop will be able to use Comment Notify without the entire comments section disappearing.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | cn-settings.png | 89.12 KB | Anonymous (not verified) |
Issue fork comment_notify-3215875
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
kurttrowbridgeI thought I was having a similar issue when trying to edit comments, and a cache clear may or may not have fixed that, but regardless, I started looking into where the JavaScript came from, so I can help with that: it was updated in #3144804: notify_type show/hide broken in combination with ajax_comments, to allow the radio buttons under "Notify me when new comments are posted" to hide when the "Notify me" checkbox is unchecked, specifically when the AJAX Comments module is enabled and the comment form is loaded via AJAX.
Before that patch, the JavaScript looked for IDs –
#edit-notifyand#edit-notify-type– instead of classes –.comment-notifyand.comment-notify-type. When the form is loaded via AJAX, the IDs sensibly become#edit-notify--VmoOMmit2Eoand#edit-notify-type--VmoOMmit2Eo(or a similar ID).I reverted the JavaScript to the pre-#3144804: notify_type show/hide broken in combination with ajax_comments version, then adjusted the selectors so that it looks for either
#edit-notifyor an ID beginning with#edit-notify--(and the same for thetype-including IDs). That seems to be doing the trick for me, and functionality still works while AJAX Comments is enabled, but additional reviews of my merge request would be much appreciated, and I can't necessarily guarantee that it will solve the problem originally presented.Comment #5
s.perilhou commentedProblem is now online with version 1.3 !
Comment #6
gregglesLooks like we've got a proposed patch here. Can you try it out and review it?
Comment #7
s.perilhou commentedHi @greggles,
Patch seems fine for me as comments are displayed, but I do not use AJAX on this form so I can not guarantee all the features.
Thank you for the module, btw!
Comment #8
shaundychkoThe patch fixes this issue, applied against 8.x-1.3.
Comment #9
cedeweyThanks all for the work on this. Assigning to gnuget to review the code.
Comment #10
cedeweyEscalating this to Major since it "Interfere with normal site visitors' use of the site." See https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-...
Comment #11
gnugetI checked the patch and looks good to me.
But not so sure to understand these two lines :
It finds all the checkboxes that are `checked` and adds the attribute `checked`?
Thanks!!!
Comment #13
gnugetComment #15
Anonymous (not verified) commentedThe problem still exist.
When the user clicks on the button to switch receiving any comment notifications, the comment form disappears.
Drupal Version 10.2 & Comment Notify 8.x-1.x-dev & Bootstrap 5
Any idea , please ?