parent
cce51e6157
commit
c16f16d18b
7 changed files with 23 additions and 23 deletions
|
@ -36,8 +36,8 @@ def get_user(username, v=None, graceful=False):
|
|||
)
|
||||
).first()
|
||||
|
||||
user.is_blocking = block and block.user_id == v.id
|
||||
user.is_blocked = block and block.target_id == v.id
|
||||
user._is_blocking = block and block.user_id == v.id
|
||||
user._is_blocked = block and block.target_id == v.id
|
||||
|
||||
return user
|
||||
|
||||
|
@ -64,8 +64,8 @@ def get_account(id, v=None):
|
|||
)
|
||||
).first()
|
||||
|
||||
user.is_blocking = block and block.user_id == v.id
|
||||
user.is_blocked = block and block.target_id == v.id
|
||||
user._is_blocking = block and block.user_id == v.id
|
||||
user._is_blocked = block and block.target_id == v.id
|
||||
|
||||
return user
|
||||
|
||||
|
@ -102,7 +102,7 @@ def get_post(i, v=None, graceful=False, **kwargs):
|
|||
abort(404)
|
||||
x = items[0]
|
||||
x.voted = items[1] or 0
|
||||
x.is_blocking = items[2] or 0
|
||||
x._is_blocking = items[2] or 0
|
||||
else:
|
||||
items = g.db.query(
|
||||
Submission
|
||||
|
@ -152,8 +152,8 @@ def get_posts(pids, v=None):
|
|||
output = [p[0] for p in query]
|
||||
for i in range(len(output)):
|
||||
output[i].voted = query[i][1] or 0
|
||||
output[i].is_blocking = query[i][2] or 0
|
||||
output[i].is_blocked = query[i][3] or 0
|
||||
output[i]._is_blocking = query[i][2] or 0
|
||||
output[i]._is_blocked = query[i][3] or 0
|
||||
else:
|
||||
output = g.db.query(Submission,).filter(Submission.id.in_(pids)).all()
|
||||
|
||||
|
@ -181,8 +181,8 @@ def get_comment(i, v=None, graceful=False, **kwargs):
|
|||
|
||||
vts = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id)
|
||||
vt = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).first()
|
||||
comment.is_blocking = block and block.user_id == v.id
|
||||
comment.is_blocked = block and block.target_id == v.id
|
||||
comment._is_blocking = block and block.user_id == v.id
|
||||
comment._is_blocked = block and block.target_id == v.id
|
||||
comment.voted = vt.vote_type if vt else 0
|
||||
|
||||
else:
|
||||
|
@ -231,8 +231,8 @@ def get_comments(cids, v=None, load_parent=False):
|
|||
comment = c[0]
|
||||
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
||||
comment.voted = c[1] or 0
|
||||
comment.is_blocking = c[2] or 0
|
||||
comment.is_blocked = c[3] or 0
|
||||
comment._is_blocking = c[2] or 0
|
||||
comment._is_blocked = c[3] or 0
|
||||
output.append(comment)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue