Open jimkring opened 4 years ago
Thanks for the report! It's been there since the beginning of this application.
I was able to sorta get around this by just adding is_removed=False
to the queryset in the template tag before XtdComment.tree_from_queryset()
is called. But there seems to be a side-effect to doing that. Any replies to comments that are marked removed still show up in the tree, e.g. if Comment B is a reply to Comment A and Comment A is marked removed, Comment B will still show up in the tree.
Filtering by is_removed
within the loop in the template seems to also work, which is what I assume @jimkring was doing (or at least something similar):
{% for item in comments %}
{% if not item.comment.is_removed %}
. . .
@rgutierrez-cotech yes, I was filtering by is_removed
within the loop, inside the template. That works well for my needs, yet it would be nice if that filtering were possible at a deeper level in the application. A nice aspect of having the removed items filtered manually, is that they can be shown to admins who can reverse the removal, if needed (in case a comment was accidentally removed).
This app has always ignored django-comments' COMMENTS_HIDE_REMOVED
setting.
The default value of that setting is True
, therefore fixing django-comments-xtd to take into account the value of COMMENTS_HIDE_REMOVED
will break backwards compatibility.
So the fix for this issue will force a change in the major version number.
In the docs for Django Comments, it describes the settings.
I've tried applying this setting and the
{% render_xtdcomment_tree for object %}
tag returning all the comments, even ones that have anis_removed
value of True, which then requires these to be manually filtered them in the template. That's not the end of the world, but figured I'd mention it.