fd
This commit is contained in:
parent
1223c41b4b
commit
e74670cc3d
1 changed files with 8 additions and 1 deletions
|
@ -105,6 +105,10 @@ def post_id(pid, anything=None, v=None):
|
||||||
|
|
||||||
blocked = v.blocked.subquery()
|
blocked = v.blocked.subquery()
|
||||||
|
|
||||||
|
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
|
||||||
|
shadowbanned = g.db.query(User.id).filter(User.shadowbanned == True).subquery()
|
||||||
|
comments = g.db.query(Comment).filter(Comment.author_id.notin_(shadowbanned))
|
||||||
|
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
votes.c.vote_type,
|
votes.c.vote_type,
|
||||||
|
@ -112,6 +116,10 @@ def post_id(pid, anything=None, v=None):
|
||||||
blocked.c.id,
|
blocked.c.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
|
||||||
|
shadowbanned = g.db.query(User.id).filter(User.shadowbanned == True).subquery()
|
||||||
|
comments = g.db.query(Comment).filter(Comment.author_id.notin_(shadowbanned))
|
||||||
|
|
||||||
if v.admin_level >=4:
|
if v.admin_level >=4:
|
||||||
comments=comments.options(joinedload(Comment.oauth_app))
|
comments=comments.options(joinedload(Comment.oauth_app))
|
||||||
|
|
||||||
|
@ -149,7 +157,6 @@ def post_id(pid, anything=None, v=None):
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
for c in comments:
|
for c in comments:
|
||||||
if c.author.shadowbanned and not (v and v.shadowbanned) and not (v and v.admin_level == 6): continue
|
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
comment.voted = c[1] or 0
|
comment.voted = c[1] or 0
|
||||||
comment._is_blocking = c[2] or 0
|
comment._is_blocking = c[2] or 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue