Unexpected tree when there are deleted comments
Opened this issue · 0 comments
Note: It seems that if you run with COMMENTS_HIDE_REMOVED = False
then things work correctly, but the default is True
. (well, except for #97, but that can be fixed in the templates)
Let's say you have the following comment tree:
- first
- second
- third
- second
If you delete the "second" comment it then renders like this:
- first
- third
This is a problem because the "third" comment is a reply to "second" but now it looks like it's a reply to "first". All other replies to "second" are also moved up like this too.
Even worse, if you submit another reply to the "first" comment you then get the following:
- first
- third
- reply to first
If you look in the database you can confirm that "reply to first" has the proper tree_path
and parent_id
. Any further comments on "first" appear below and at the same level as "reply to first".
If you then delete the "first" comment you'll then get this:
- first
- second
- third
- reply to first
- second
Both "first" and "second" are actually properly marked as is_removed
so a fix for #97 in the template would mean the deleted ones would be rendered as "deleted" or something like that. In the example before this one, the "second" comment isn't even in the tree so it can't be handled in the template.
EDIT: I should clarify that I'm using django_comments.views.moderation.perform_delete
to "delete" the ThreadedComment
object (ie it's marking it as is_removed=True
and not actually deleting).