danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
594 stars 157 forks source link

Delete comment and replies #173

Closed ogurec-ogurec closed 4 years ago

ogurec-ogurec commented 4 years ago

The situation is as follows, we have for example 4 comments:

Comment №1 -Reply Comment --Reply Comment ---Reply Comment

If you delete comment № 1 in the admin panel (do not mark it as deleting, namely delete it from the database), he comment is deleted, but the answers remain, and when you try to show a comments (render the page), an error is displayed in the console and comments are not displayed:

commentbox.jsx:113 Uncaught TypeError: Cannot read property 'push' of undefined
    at o.value (commentbox.jsx:113)
    at o.<anonymous> (commentbox.jsx:150)
    at fire (jquery-3.5.0.js:3496)
    at Object.fireWith [as resolveWith] (jquery-3.5.0.js:3626)
    at done (jquery-3.5.0.js:9786)
    at XMLHttpRequest.<anonymous> (jquery-3.5.0.js:10047)

That is, if to summarize: If you delete a comment and leave answers, then the page with comments will not be displayed, but an error will be displayed.

If you follow the same procedure, but do not delete the comment, but "mark as deleted", then the response thread under this comment is hidden and the comment itself is not displayed. (I think this is the correct logic)