From 1971dc1b7321563be711d8269b5a04a367c54916 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 22 Mar 2023 21:53:59 +0200 Subject: [PATCH] improve /@/comments --- files/routes/users.py | 13 ++++++++++++- files/templates/comments.html | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 49ac47abe..9ea64e931 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -1034,9 +1034,20 @@ def u_username_comments(username, v=None): for x in comments: if x.replies2 == None: x.replies2 = [] if x.parent_comment_id: - x.parent_comment.replies2 = [x] + if x.parent_comment.replies2 == None: + x.parent_comment.replies2 = [] + + x.parent_comment.replies2.append(x) + x.parent_comment.replies2.sort(key=lambda x: x.created_utc, reverse=True) + x = x.parent_comment if x.id in ids: continue + if x.parent_comment_id in ids: + if x.parent_comment.replies2 == None: + x.parent_comment.replies2 = [] + x.parent_comment.replies2.append(x) + x.parent_comment.replies2.sort(key=lambda x: x.created_utc, reverse=True) + continue listing.append(x) ids.update([x.id for x in listing]) diff --git a/files/templates/comments.html b/files/templates/comments.html index ee055f7fe..65bc2ecc8 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -113,13 +113,15 @@ {% set isreply = False %} {% endif %} +{% set highlight_for_profile = request.path.startswith('/@') and request.path.endswith('/comments') and v and c.author_id == v.id %} +
{% if not isreply %} {% endif %}
-
+