From 3e122bbd59c248206e36487bc6366bb1f718e9a9 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 22 Mar 2023 19:02:04 +0200 Subject: [PATCH] show parent comment in /@username/comments --- files/routes/users.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/files/routes/users.py b/files/routes/users.py index f5e0390605..448fc576c2 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -1030,11 +1030,20 @@ def u_username_comments(username, v=None): ids = ids[:PAGE_SIZE] listing = get_comments(ids, v=v) + listing2 = [] + + for x in listing: + if x.parent_comment_id: + x.parent_comment.replies2 = [x] + x = x.parent_comment + listing2.append(x) + + listing = listing2 if v and v.client: return {"data": [c.json(g.db) for c in listing]} - return render_template("userpage/comments.html", u=u, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) + return render_template("userpage/comments.html", u=u, v=v, listing=listing, page=page, sort=sort, t=t, next_exists=next_exists, is_following=is_following, standalone=True, render_replies=True) @app.get("/@/info")