made it not possible to edit posts/comments older than a week

remotes/1693045480750635534/spooky-22
Aevann1 2022-06-18 22:53:10 +02:00
parent eba4452d79
commit 668cfdc90a
2 changed files with 6 additions and 0 deletions

View File

@ -654,6 +654,9 @@ def edit_comment(cid, v):
c = get_comment(cid, v=v)
if time.time() - c.created_utc > 7*24*60*60:
return {"error":"You can't edit comments older than 1 week!"}, 403
if c.author_id != v.id: abort(403)
body = request.values.get("body", "").strip()[:10000]

View File

@ -440,6 +440,9 @@ def morecomments(v, cid):
def edit_post(pid, v):
p = get_post(pid)
if time.time() - p.created_utc > 7*24*60*60:
return {"error":"You can't edit posts older than 1 week!"}, 403
if p.author_id != v.id and not (v.admin_level > 1 and v.admin_level > 2): abort(403)
title = request.values.get("title", "").strip().replace('','')