forked from rDrama/rDrama
1
0
Fork 0
Aevann1 2022-07-29 02:43:22 +02:00
parent b06524a895
commit f920371f3a
1 changed files with 2 additions and 4 deletions

View File

@ -23,10 +23,6 @@ def api_flag_post(pid, v):
reason = reason[:100]
if not reason.startswith('!'):
existing = g.db.query(Flag.post_id).filter_by(user_id=v.id, post_id=post.id).one_or_none()
if existing: return "", 409
reason = filter_emojis_only(reason)
if len(reason) > 350: return {"error": "Too long."}
@ -67,6 +63,8 @@ def api_flag_post(pid, v):
return {"message": f"Post moved to /h/{post.sub}"}
else:
existing = g.db.query(Flag.post_id).filter_by(user_id=v.id, post_id=post.id).one_or_none()
if existing: return "", 409
flag = Flag(post_id=post.id, user_id=v.id, reason=reason)
g.db.add(flag)