From 13bd73d4d8925347c930ed3a696faa70e53632bc Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 20:58:46 +0200 Subject: [PATCH] sfdfsd --- files/classes/submission.py | 1 + files/routes/front.py | 27 +++++++++++---------------- files/templates/home_comments.html | 4 ++-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 668b9cd7a..d876b25a0 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -336,6 +336,7 @@ class Submission(Base): rand = random.randint(0, maxupvotes) if self.upvotes < rand: amount = random.randint(0, 3) + self.views += amount*random.randint(3, 5) self.upvotes += amount g.db.add(self) self.author.coins += amount diff --git a/files/routes/front.py b/files/routes/front.py index 75ea1b9af..2bd50296e 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -429,25 +429,20 @@ def all_comments(v): sort=request.values.get("sort", "new") t=request.values.get("t", defaulttimefilter) - if request.values.get("shadowbanned") and v and v.admin_level > 1: - idlist = comment_idlist(v=v, - page=page, - sort=sort, - t=t, - shadowbanned=true - ) - comments = get_comments(idlist, v=v, shadowbanned=True) - else: - idlist = comment_idlist(v=v, - page=page, - sort=sort, - t=t, - ) - comments = get_comments(idlist, v=v) + if request.values.get("shadowbanned") and v and v.admin_level > 1: shadowbanned = True + else: shadowbanned = False + + idlist = comment_idlist(v=v, + page=page, + sort=sort, + t=t, + shadowbanned=shadowbanned + ) + comments = get_comments(idlist, v=v, shadowbanned=shadowbanned) next_exists = len(idlist) > 25 idlist = idlist[:25] if request.headers.get("Authorization"): return {"data": [x.json for x in comments]} - else: return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) + else: return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists, shadowbanned=shadowbanned) diff --git a/files/templates/home_comments.html b/files/templates/home_comments.html index 2eb2ed89b..6226ab6d8 100644 --- a/files/templates/home_comments.html +++ b/files/templates/home_comments.html @@ -71,14 +71,14 @@