master
Aevann1 2021-09-12 09:41:08 +02:00
parent 4790b1bb23
commit 8562bd8987
1 changed files with 3 additions and 4 deletions

View File

@ -162,9 +162,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
if lt:
posts = posts.filter(Submission.created_utc < lt)
# if not (v and v.shadowbanned):
# posts = posts.join(Submission.author).filter(User.shadowbanned == False)
if sort == "hot":
posts = sorted(posts.all(), key=lambda x: x.hotscore, reverse=True)
elif sort == "new":
@ -186,7 +183,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
abort(400)
firstrange = 25 * (page - 1)
secondrange = firstrange+200
secondrange = firstrange+100
posts = posts[firstrange:secondrange]
if random.random() < 0.004:
@ -206,6 +203,8 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
post.views = post.views + random.randint(7,10)
g.db.add(post)
posts = [p for p in posts if not p.author.shadowbanned]
next_exists = (len(posts) > 25)
posts = posts[:25]