From cd7df62428fb3dc4824fc3fa225a5e18835af2b5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 11 Nov 2021 22:04:49 +0200 Subject: [PATCH] fd --- files/routes/front.py | 10 ++++++++++ files/routes/posts.py | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/files/routes/front.py b/files/routes/front.py index c8301ff7d..84a043fa7 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -182,6 +182,16 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' elif t == 'year': cutoff = now - 31536000 else: cutoff = now - 86400 posts = posts.filter(Submission.created_utc >= cutoff) + else: cutoff = 0 + + if random.random() < 0.02: + p2 = g.db.query(Submission).filter(Submission.created_utc >= cutoff).all() + for post in p2: + if post.author and post.author.shadowbanned: + rand = random.randint(5,20) + if post.score < rand: post.upvotes += 1 + g.db.add(post) + g.db.commit() posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0) diff --git a/files/routes/posts.py b/files/routes/posts.py index 723b4b1d5..0e3fba4fa 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -189,6 +189,13 @@ def post_id(pid, anything=None, v=None): post.replies = comments.filter(Comment.is_pinned != None).all() + comments.filter(Comment.level == 1, Comment.is_pinned == None).all() + if random.random() < 0.02: + for comment in post.replies: + if comment.author and comment.author.shadowbanned: + rand = random.randint(5,20) + if comment.score < rand: comment.upvotes += 1 + g.db.add(comment) + post.views += 1 g.db.add(post) if isinstance(session.get('over_18', 0), dict): session["over_18"] = 0