fd
This commit is contained in:
parent
9d5bcbf82e
commit
3591059742
2 changed files with 17 additions and 0 deletions
|
@ -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
|
elif t == 'year': cutoff = now - 31536000
|
||||||
else: cutoff = now - 86400
|
else: cutoff = now - 86400
|
||||||
posts = posts.filter(Submission.created_utc >= cutoff)
|
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)
|
posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0)
|
||||||
|
|
||||||
|
|
|
@ -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()
|
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
|
post.views += 1
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
if isinstance(session.get('over_18', 0), dict): session["over_18"] = 0
|
if isinstance(session.get('over_18', 0), dict): session["over_18"] = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue