This commit is contained in:
Aevann1 2021-09-17 10:29:05 +02:00
parent 62a5278af4
commit 6cc19ce02a
21 changed files with 194 additions and 194 deletions

View file

@ -209,7 +209,7 @@ def award_post(pid, v):
if kind not in AWARDS:
return {"error": "That award doesn't exist."}, 404
post_award = g.db.query(AwardRelationship).filter(
post_award = g.db.query(AwardRelationship).options(lazyload('*')).filter(
and_(
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
@ -221,7 +221,7 @@ def award_post(pid, v):
if not post_award:
return {"error": "You don't have that award."}, 404
post = g.db.query(Submission).filter_by(id=pid).first()
post = g.db.query(Submission).options(lazyload('*')).filter_by(id=pid).first()
if not post or post.is_banned or post.deleted_utc > 0:
return {"error": "That post doesn't exist or has been deleted or removed."}, 404
@ -229,7 +229,7 @@ def award_post(pid, v):
if post.author_id == v.id:
return {"error": "You can't award yourself."}, 403
existing_award = g.db.query(AwardRelationship).filter(
existing_award = g.db.query(AwardRelationship).options(lazyload('*')).filter(
and_(
AwardRelationship.submission_id == post.id,
AwardRelationship.user_id == v.id,
@ -275,7 +275,7 @@ def award_comment(cid, v):
if kind not in AWARDS:
return {"error": "That award doesn't exist."}, 404
comment_award = g.db.query(AwardRelationship).filter(
comment_award = g.db.query(AwardRelationship).options(lazyload('*')).filter(
and_(
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
@ -287,7 +287,7 @@ def award_comment(cid, v):
if not comment_award:
return {"error": "You don't have that award."}, 404
c = g.db.query(Comment).filter_by(id=cid).first()
c = g.db.query(Comment).options(lazyload('*')).filter_by(id=cid).first()
if not c or c.is_banned or c.deleted_utc > 0:
return {"error": "That comment doesn't exist or has been deleted or removed."}, 404
@ -295,7 +295,7 @@ def award_comment(cid, v):
if c.author_id == v.id:
return {"error": "You can't award yourself."}, 403
existing_award = g.db.query(AwardRelationship).filter(
existing_award = g.db.query(AwardRelationship).options(lazyload('*')).filter(
and_(
AwardRelationship.comment_id == c.id,
AwardRelationship.user_id == v.id,