This commit is contained in:
Aevann1 2022-01-22 22:03:46 +02:00
parent f59d4e6f11
commit bdc1745e37
3 changed files with 11 additions and 11 deletions

View file

@ -241,13 +241,14 @@ def api_comment(v):
if ban.reason: reason += f" {ban.reason}"
return {"error": reason}, 401
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.deleted_utc == 0,
Comment.parent_comment_id == parent_comment_id,
Comment.parent_submission == parent_submission,
Comment.body_html == body_html
).one_or_none()
if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409
if parent_post.id not in (37696,37697,37749,37833,37838):
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.deleted_utc == 0,
Comment.parent_comment_id == parent_comment_id,
Comment.parent_submission == parent_submission,
Comment.body_html == body_html
).one_or_none()
if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409
if parent.author.any_block_exists(v) and v.admin_level < 2: return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403