forked from rDrama/rDrama
1
0
Fork 0
Aevann 2023-08-08 17:51:20 +03:00
parent 5f8bc0442b
commit fa0f082104
1 changed files with 6 additions and 1 deletions

View File

@ -177,7 +177,12 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
@auth_required
def random_post(v):
p = g.db.query(Post.id).filter(Post.deleted_utc == 0, Post.is_banned == False, Post.private == False).order_by(func.random()).first()
p = g.db.query(Post.id).filter(
Post.deleted_utc == 0,
Post.is_banned == False,
Post.private == False,
or_(Post.sub == None, Post.sub.notin_(v.sub_blocks)),
).order_by(func.random()).first()
if p: p = p[0]
else: abort(404)