remotes/1693045480750635534/spooky-22
Aevann1 2021-08-06 17:56:45 +02:00
parent 631626f07e
commit 8a2f4030c8
1 changed files with 18 additions and 5 deletions

View File

@ -77,16 +77,27 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
for i in range(6 - context): for i in range(6 - context):
if v: if v:
blocking = v.blocking.subquery() votes = g.db.query(CommentVote).filter_by(user_id=v.id).subquery()
blocked = v.blocked.subquery()
blocking = v.blocking.subquery()
blocked = v.blocked.subquery()
comments = g.db.query( comments = g.db.query(
Comment, Comment,
votes.c.vote_type,
blocking.c.id, blocking.c.id,
blocked.c.id, blocked.c.id,
).filter( )
if v.admin_level >=4:
comments=comments.options(joinedload(Comment.oauth_app))
comments=comments.filter(
Comment.parent_comment_id.in_(current_ids) Comment.parent_comment_id.in_(current_ids)
).join(
votes,
votes.c.comment_id == Comment.id,
isouter=True
).join( ).join(
blocking, blocking,
blocking.c.target_id == Comment.author_id, blocking.c.target_id == Comment.author_id,
@ -116,8 +127,10 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
output = [] output = []
for c in comments: for c in comments:
comment = c[0] comment = c[0]
comment._is_blocking = c[1] or 0 if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
comment._is_blocked = c[2] or 0 comment._voted = c[1] or 0
comment._is_blocking = c[2] or 0
comment._is_blocked = c[3] or 0
output.append(comment) output.append(comment)
else: else: