From 8c372a4847b7eaddaa161b235cf8c691972c516e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 11 Dec 2021 02:23:01 +0200 Subject: [PATCH 1/3] dfsfsd --- files/routes/posts.py | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 5a203a1ce..cb1c1f7f9 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -326,8 +326,44 @@ def viewmore(v, pid, sort, offset): @limiter.limit("1/second") @auth_desired def morecomments(v, cid): - c = g.db.query(Comment).filter_by(id=cid).first() - comments = c.replies + if v: + votes = g.db.query(CommentVote).filter_by(user_id=v.id).subquery() + + blocking = v.blocking.subquery() + + blocked = v.blocked.subquery() + + comments = g.db.query( + Comment, + votes.c.vote_type, + blocking.c.id, + blocked.c.id, + ).filter_by(parent_comment_id=cid).join( + votes, + votes.c.comment_id == Comment.id, + isouter=True + ).join( + blocking, + blocking.c.target_id == Comment.author_id, + isouter=True + ).join( + blocked, + blocked.c.user_id == Comment.author_id, + isouter=True + ) + + output = [] + for c in comments.all(): + comment = c[0] + comment.voted = c[1] or 0 + comment.is_blocking = c[2] or 0 + comment.is_blocked = c[3] or 0 + output.append(comment) + comments = output + else: + c = g.db.query(Comment).filter_by(id=cid).first() + comments = c.replies + return render_template("comments.html", v=v, comments=comments, render_replies=True) @app.post("/edit_post/") From 838df002a70a7248c2f04bcacc640d4e48a8c13c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 11 Dec 2021 02:53:16 +0200 Subject: [PATCH 2/3] dfssfd --- files/classes/badges.py | 10 ++-------- files/classes/user.py | 1 + files/templates/comments.html | 4 ++-- files/templates/submission_listing.html | 4 ++-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/files/classes/badges.py b/files/classes/badges.py index 3be59fa9c..c751247d5 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -50,15 +50,9 @@ class Badge(Base): @property @lazy - def json_core(self): - + def json(self): return {'text': self.text, 'name': self.name, 'url': self.url, 'icon_url':f"https://{app.config['SERVER_NAME']}{self.path}" - } - - @property - @lazy - def json(self): - return self.json_core + } \ No newline at end of file diff --git a/files/classes/user.py b/files/classes/user.py index c8c6b26e1..645dbce37 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -434,6 +434,7 @@ class User(Base): 'coins': self.coins, 'post_count': self.post_count, 'comment_count': self.comment_count, + 'badges': [x.path for x in self.badges], } return data diff --git a/files/templates/comments.html b/files/templates/comments.html index 6074a4a1d..3e320bbac 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -40,7 +40,7 @@ -
+
@@ -758,7 +758,7 @@ {% include "expanded_image_modal.html" %} - + - + \ No newline at end of file From bea97ea12d243b47a90e35afb143387c8c286a62 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 11 Dec 2021 02:54:33 +0200 Subject: [PATCH 3/3] fsdsfd --- files/templates/comments.html | 2 +- files/templates/submission_listing.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/templates/comments.html b/files/templates/comments.html index 3e320bbac..ea82323e4 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -682,7 +682,7 @@ } .popover { - max-width: 90%; + max-width: 50%; box-shadow: 0 1rem 3rem rgba(0, 0, 0, .175); border-color: #dadada; } diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index ed7a24ae5..6145e0430 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -575,7 +575,7 @@