This commit is contained in:
Aevann1 2022-02-04 15:11:11 +02:00
parent 27e51ac01d
commit 9cf8ceec01
9 changed files with 174 additions and 12 deletions

View file

@ -66,13 +66,24 @@ def remove_report(report_fn, v):
if report_fn.startswith('c'):
report = g.db.query(CommentFlag).filter_by(id=int(report_fn.lstrip('c'))).one_or_none()
ma=ModAction(
kind="delete_report_comment",
user_id=v.id,
target_comment_id=report.comment_id
)
elif report_fn.startswith('p'):
report = g.db.query(Flag).filter_by(id=int(report_fn.lstrip('p'))).one_or_none()
else:
return {"error": "Invalid report ID"}, 400
ma=ModAction(
kind="delete_report_post",
user_id=v.id,
target_submission_id=report.post_id
)
else: return {"error": "Invalid report ID"}, 400
g.db.delete(report)
g.db.add(ma)
g.db.commit()
return {"message": "Removed report"}