diff --git a/make_post_sell/models/comment.py b/make_post_sell/models/comment.py index c7c7c48..38f9d0b 100644 --- a/make_post_sell/models/comment.py +++ b/make_post_sell/models/comment.py @@ -128,6 +128,11 @@ class Comment(RBase, Base): def unverified_children(self): return self.children.filter(Comment.verified == False) + @property + def enabled_children(self): + """Get all non-disabled child comments.""" + return self.children.filter(Comment.disabled == False) + @property def path_to_root(self): """The path from this comment to the root comment.""" diff --git a/make_post_sell/request_methods.py b/make_post_sell/request_methods.py index 1b10ba1..826d1fc 100644 --- a/make_post_sell/request_methods.py +++ b/make_post_sell/request_methods.py @@ -322,7 +322,9 @@ def includeme(config): # Payment method checks config.add_request_method(add_stripe_enabled, "stripe_enabled", reify=True) - config.add_request_method(add_stripe_globally_enabled, "stripe_globally_enabled", reify=True) + config.add_request_method( + add_stripe_globally_enabled, "stripe_globally_enabled", reify=True + ) config.add_request_method(add_monero_enabled, "monero_enabled", reify=True) config.add_request_method( add_monero_rpc_available, "monero_rpc_available", reify=True diff --git a/make_post_sell/templates/snippets/comments.j2 b/make_post_sell/templates/snippets/comments.j2 index 4c859b9..cf37b92 100644 --- a/make_post_sell/templates/snippets/comments.j2 +++ b/make_post_sell/templates/snippets/comments.j2 @@ -1,6 +1,6 @@ {% macro render_comment(comment, shop, request, max_depth=5) %} {% if comment.depth <= max_depth and (comment.approved or (request.user.authenticated and (shop.is_owner(request.user) or shop.is_editor(request.user)))) %} -
+
{{ comment.user.name if comment.user else "Anonymous" }} {{ comment.ago_string }} @@ -45,8 +45,8 @@ {% endif %}
- {% if comment.children %} - {% for child in comment.children %} + {% if comment.enabled_children %} + {% for child in comment.enabled_children %} {{ render_comment(child, shop, request, max_depth) }} {% endfor %} {% endif %} @@ -84,7 +84,7 @@
- +