From dc6f4f8e10873aceead1616aa24266a65ac193da Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 17 Sep 2022 23:45:17 +0200 Subject: [PATCH] do this https://rdrama.net/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/2723089?context=8#context --- files/classes/comment.py | 1 - files/templates/comments.html | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 4d4592eaf..4601ad2d1 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -67,7 +67,6 @@ class Comment(Base): post = relationship("Submission", back_populates="comments") author = relationship("User", primaryjoin="User.id==Comment.author_id") senttouser = relationship("User", primaryjoin="User.id==Comment.sentto") - top_comment = relationship("Comment", primaryjoin="Comment.id==Comment.top_comment_id") parent_comment = relationship("Comment", remote_side=[id], back_populates="child_comments") child_comments = relationship("Comment", order_by="Comment.stickied, Comment.realupvotes.desc()", remote_side=[parent_comment_id], back_populates="parent_comment") awards = relationship("AwardRelationship", order_by="AwardRelationship.awarded_utc.desc()", back_populates="comment") diff --git a/files/templates/comments.html b/files/templates/comments.html index f168d4b4e..1bb01ba3a 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -15,7 +15,7 @@ {% include "popover.html" %} {% endif %} -{% macro single_comment(c, level=1) %} +{% macro single_comment(c, level=1, collapse=False) %} {% set ups=c.upvotes %} {% set downs=c.downvotes %} @@ -114,7 +114,7 @@ {% set isreply = False %} {% endif %} -
+
{% if not isreply %} {% endif %} @@ -553,7 +553,11 @@ {% if render_replies %}
- {% if level<9 or request.path.startswith('/notifications') %} + {% if request.path.startswith('/notifications') and replies|length > 8 %} + {% for reply in replies %} + {{single_comment(reply, level=level+1, collapse=(not reply.unread and loop.index != replies|length))}} + {% endfor %} + {% elif request.path.startswith('/notifications') or level < 9 %} {% for reply in replies %} {{single_comment(reply, level=level+1)}} {% endfor %}