remotes/1693045480750635534/spooky-22
Aevann1 2021-11-11 22:04:49 +02:00
parent 4d4836ec77
commit cd7df62428
2 changed files with 17 additions and 0 deletions

View File

@ -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)

View File

@ -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