fddf
This commit is contained in:
parent
e3a0f9e1a8
commit
baf90af158
1 changed files with 2 additions and 26 deletions
|
@ -497,8 +497,7 @@ def get_comments(cids, v=None, g.db=None, sort="new",
|
||||||
query = g.db.query(
|
query = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
aliased(CommentVote, alias=vt),
|
aliased(CommentVote, alias=vt),
|
||||||
).options(
|
)
|
||||||
joinedload(Comment.author))
|
|
||||||
|
|
||||||
if v.admin_level >=4:
|
if v.admin_level >=4:
|
||||||
query=query.options(joinedload(Comment.oauth_app))
|
query=query.options(joinedload(Comment.oauth_app))
|
||||||
|
@ -507,8 +506,6 @@ def get_comments(cids, v=None, g.db=None, sort="new",
|
||||||
query = query.options(
|
query = query.options(
|
||||||
joinedload(
|
joinedload(
|
||||||
Comment.parent_comment
|
Comment.parent_comment
|
||||||
).joinedload(
|
|
||||||
Comment.author
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -523,34 +520,13 @@ def get_comments(cids, v=None, g.db=None, sort="new",
|
||||||
Comment.id.in_(cids)
|
Comment.id.in_(cids)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
output = [x[0] for x in query.all()]
|
output = [x[0] for x in query.all()]
|
||||||
for i in range(len(output)):
|
for i in range(len(output)):
|
||||||
output[i]._voted = comments[i][1].vote_type if comments[i][1] else 0
|
output[i]._voted = comments[i][1].vote_type if comments[i][1] else 0
|
||||||
output[i]._is_guildmaster = comments[i][2]
|
|
||||||
output[i]._is_exiled_for = comments[i][3]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
query = g.db.query(
|
output = g.db.query(Comment).options().filter(Comment.id.in_(cids)).all()
|
||||||
Comment,
|
|
||||||
aliased(ModAction, alias=exile)
|
|
||||||
).options(
|
|
||||||
joinedload(Comment.author).joinedload(User.title),
|
|
||||||
joinedload(Comment.post).joinedload(Submission.board)
|
|
||||||
).filter(
|
|
||||||
Comment.id.in_(cids)
|
|
||||||
).join(
|
|
||||||
exile,
|
|
||||||
and_(exile.c.target_comment_id==Comment.id, exile.c.board_id==Comment.original_board_id),
|
|
||||||
isouter=True
|
|
||||||
).order_by(None).all()
|
|
||||||
|
|
||||||
comments=[x for x in query]
|
|
||||||
|
|
||||||
output=[x[0] for x in comments]
|
|
||||||
for i in range(len(output)):
|
for i in range(len(output)):
|
||||||
output[i]._is_exiled_for=comments[i][1]
|
output[i]._is_exiled_for=comments[i][1]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue