-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript error on cancel of the block user modal. #230
Comments
At a guess after glancing around the js file, it seems this might be related to selection functions for disabled feature modals. It seems to find "nearest" as followModal or CreateAnonymousCommentModal, both of which I disabled in settings. If I remove the hide functions for those (follow and CreateAnonymous) modals (around lines 40-50), as well as the references to those functions in the click listener (around lines 790-800) the problems go away. |
Thanks for taking the time to report the issue, and on its initial investigation, i also get an error after closing the modal for blocking the user. although the modal closes successfully for me, i get an error: Uncaught TypeError: createAnonymousCommentModal is null
hideCreateAnonymousCommentModal http://localhost:8000/static/js/comment.js:46
<anonymous> http://localhost:8000/static/js/comment.js:792 i will try to investigate more on this. if you could give me additional information about the custom settings that you're using for |
- the issue occured if and when the modal wasn't active and the hideModal was called to close it.
@awhileback can you verify whether the linked pull request fixes your issue? |
COMMENT_ALLOW_SUBSCRIPTION and COMMENT_ALLOW_ANONYMOUS are both disabled by default per the docs (and can confirm, I don't see icons for them on the page) so I didn't bother explicitly disabling them in settings. The linked PR still fails in a similar manner, it mentions the followModal on line 792...
Something that may be related, which I had to deal with while customizing the templates a bit... I noticed when adding an icon for "reply" that the JS was looking for an Nth parent (by number) element to find the root of the current comment tree, and then selecting the reply div under that root element. That's all fine and good, but what I ran into is the The following seems to be a more reliable selector, for example, on lines 43-46...
And adding I probably need to check browser compatibility on those but they seem to work okay in Chrome, Safari, and Firefox on my laptop. |
- the issue occured if and when the modal wasn't active and the hideModal was called to close it.
@awhileback Thank you so much for the information. I think the main cause of the issue is that there is being an attempt to close/hide a modal element that doesn't exist inside the DOM(document object model) i have added the checks inside the |
- the issue occured if and when the modal wasn't active and the hideModal was called to close it.
Thanks, all working fine! |
thanks, for checking and the relay of information back and forth. |
Environment
Describe the bug
Closing the "block user" modal raises a javascript error and the modal fails to close.
Steps To Reproduce
Expected behavior
Cancel the action and close the modal.
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered: