Restrict editing old posts (harmonize comments).

master
Snakes 2022-10-10 23:40:08 -04:00
parent c381466389
commit 69f1b09a76
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 5 additions and 0 deletions

View File

@ -411,6 +411,11 @@ def edit_post(pid, v):
if v.id != p.author_id and v.admin_level < PERMS['POST_EDITING']:
abort(403)
# Disable edits on things older than 1wk unless it's a draft or editor is a jannie
if (time.time() - p.created_utc > 7*24*60*60 and not p.private
and not v.admin_level >= PERMS['POST_EDITING']):
return {"error": "You can't edit posts older than 1 week!"}, 403
title = sanitize_raw_title(request.values.get("title", ""))
body = sanitize_raw_body(request.values.get("body", ""), True)