master
Aevann1 2022-02-25 18:39:03 +02:00
parent be445a99b1
commit 031d74efdb
1 changed files with 10 additions and 12 deletions

View File

@ -271,14 +271,13 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
posts = g.db.query(Submission)
if sub: posts = posts.filter_by(sub=sub.name)
elif subsonly:
posts = posts.filter(Submission.sub != None)
if v and v.all_blocks: posts = posts.filter(Submission.sub.notin_(v.all_blocks))
elif subs:
if v and v.all_blocks: posts = posts.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
else:
if subsonly:
posts = posts.filter(Submission.sub != None)
if v and v.all_blocks: posts = posts.filter(Submission.sub.notin_(v.all_blocks))
elif SITE_NAME == 'Drama': posts = posts.filter(Submission.sub == None)
elif v and v.all_blocks: posts = posts.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
elif SITE_NAME == 'Drama': posts = posts.filter(Submission.sub == None)
elif v and v.all_blocks: posts = posts.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
if gt: posts = posts.filter(Submission.created_utc > gt)
if lt: posts = posts.filter(Submission.created_utc < lt)
@ -352,14 +351,13 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false" and not gt and not lt:
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False)
if sub: pins = pins.filter_by(sub=sub.name)
elif subsonly:
pins = pins.filter(Submission.sub != None)
if v and v.all_blocks: pins = pins.filter(Submission.sub.notin_(v.all_blocks))
elif subs:
if v and v.all_blocks: pins = pins.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
else:
if subsonly:
pins = pins.filter(Submission.sub != None)
if v and v.all_blocks: pins = pins.filter(Submission.sub.notin_(v.all_blocks))
elif SITE_NAME == 'Drama': pins = pins.filter(Submission.sub == None)
elif v and v.all_blocks: pins = pins.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
elif SITE_NAME == 'Drama': pins = pins.filter(Submission.sub == None)
elif v and v.all_blocks: pins = pins.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
if v and v.admin_level == 0:
blocking = [x[0] for x in g.db.query(UserBlock.target_id).filter_by(user_id=v.id).all()]