master
Aevann1 2021-09-17 14:09:07 +02:00
parent b71e25a7ff
commit f626a15a6a
3 changed files with 12 additions and 13 deletions

View File

@ -138,10 +138,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
if v and v.admin_level == 0:
blocking = g.db.query(
UserBlock.target_id).filter_by(
user_id=v.id).subquery()
user_id=v.id).all()
blocked = g.db.query(
UserBlock.user_id).filter_by(
target_id=v.id).subquery()
target_id=v.id).all()
posts = posts.filter(
Submission.author_id.notin_(blocking),
Submission.author_id.notin_(blocked)
@ -270,10 +270,10 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
if v and v.admin_level == 0:
blocking = g.db.query(
UserBlock.target_id).filter_by(
user_id=v.id).subquery()
user_id=v.id).all()
blocked = g.db.query(
UserBlock.user_id).filter_by(
target_id=v.id).subquery()
target_id=v.id).all()
posts = posts.filter(
Submission.author_id.notin_(blocking),
Submission.author_id.notin_(blocked)
@ -378,7 +378,7 @@ def random_post(v):
def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
posts = g.db.query(Submission).options(lazyload('*'))
cc_idlist = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.club == True).subquery()
cc_idlist = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.club == True).all()
posts = posts.subquery()
@ -387,10 +387,10 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
if v and v.admin_level <= 3:
blocking = g.db.query(
UserBlock.target_id).filter_by(
user_id=v.id).subquery()
user_id=v.id).all()
blocked = g.db.query(
UserBlock.user_id).filter_by(
target_id=v.id).subquery()
target_id=v.id).all()
comments = comments.filter(
Comment.author_id.notin_(blocking),

View File

@ -110,7 +110,7 @@ def post_id(pid, anything=None, v=None):
blocked = v.blocked.subquery()
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).subquery()
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()
comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id.notin_(shadowbanned))
comments = g.db.query(
@ -121,7 +121,7 @@ def post_id(pid, anything=None, v=None):
)
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).subquery()
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
if v.admin_level >=4:
@ -170,8 +170,7 @@ def post_id(pid, anything=None, v=None):
post.preloaded_comments = output
else:
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).subquery()
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()
comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.parent_submission == post.id, Comment.author_id.notin_(shadowbanned))
if sort == "top":

View File

@ -90,10 +90,10 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None):
elif v:
blocking = g.db.query(
UserBlock.target_id).filter_by(
user_id=v.id).subquery()
user_id=v.id).all()
blocked = g.db.query(
UserBlock.user_id).filter_by(
target_id=v.id).subquery()
target_id=v.id).all()
posts = posts.filter(
Submission.author_id.notin_(blocking),