From fc8c8b08a023b150f531337abef2a04e2617a04a Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 23 Sep 2022 17:33:46 -0400 Subject: [PATCH 1/8] Add "Upvoted" post/comment lists on profile. --- files/routes/users.py | 51 +++++++++++++++++++++++++++++++++++ files/templates/userpage.html | 4 +-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index aade935c8..68bc3a9fe 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -237,6 +237,57 @@ def downvoting_comments(v, username, uid): return render_template("voted_comments.html", next_exists=next_exists, listing=listing, page=page, v=v, standalone=True) +@app.get("/@/upvoted/posts") +@auth_required +def user_upvoted_posts(v, username): + u = get_user(username) + if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)): abort(403) + if not (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']): abort(403) + + page = max(1, int(request.values.get("page", 1))) + + listing = g.db.query(Submission).join(Vote).filter( + Submission.ghost == False, + Submission.is_banned == False, + Submission.deleted_utc == 0, + Submission.author_id != u.id, + Vote.user_id == u.id, + Vote.vote_type == 1 + ).order_by(Submission.created_utc.desc()).offset(25 * (page - 1)).limit(26).all() + + listing = [p.id for p in listing] + next_exists = len(listing) > 25 + listing = listing[:25] + listing = get_posts(listing, v=v) + + return render_template("voted_posts.html", next_exists=next_exists, listing=listing, page=page, v=v) + + +@app.get("/@/upvoted/comments") +@auth_required +def user_upvoted_comments(v, username): + u = get_user(username) + if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)): abort(403) + if not (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']): abort(403) + + page = max(1, int(request.values.get("page", 1))) + + listing = g.db.query(Comment).join(CommentVote).filter( + Comment.ghost == False, + Comment.is_banned == False, + Comment.deleted_utc == 0, + Comment.author_id != u.id, + CommentVote.user_id == u.id, + CommentVote.vote_type == 1 + ).order_by(Comment.created_utc.desc()).offset(25 * (page - 1)).limit(26).all() + + listing = [c.id for c in listing] + next_exists = len(listing) > 25 + listing = listing[:25] + listing = get_comments(listing, v=v) + + return render_template("voted_comments.html", next_exists=next_exists, listing=listing, page=page, v=v, standalone=True) + @app.get("/poorcels") @auth_required diff --git a/files/templates/userpage.html b/files/templates/userpage.html index df8919e39..9882d3493 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -122,7 +122,7 @@ {% endif %} {% if v and (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']) -%} - + {%- endif %}
@@ -457,7 +457,7 @@ {% endif %} {% if v and (v.id == u.id or v.admin_level >= PERMS['USER_VOTERS_VISIBLE']) -%} - + {%- endif %}
From baf93e48543826ebf48eceacee82ffa5a01a500c Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 23 Sep 2022 17:42:21 -0400 Subject: [PATCH 2/8] PCM /live: fix hover border resizing table rows. --- files/templates/live.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/templates/live.html b/files/templates/live.html index 911f16086..0a0dd84c0 100644 --- a/files/templates/live.html +++ b/files/templates/live.html @@ -6,8 +6,11 @@ {% block content %}