add IGNORE_1WEEk_EDITING_LIMIT perm

master
Aevann 2023-03-06 22:22:15 +02:00
parent d2a888a82f
commit a76729cda5
3 changed files with 5 additions and 3 deletions

View File

@ -467,6 +467,7 @@ PERMS = { # Minimum admin_level to perform action.
'BUY_GHOST_AWARD': 2,
'LOTTERY_VIEW_PARTICIPANTS': 2,
'POST_COMMENT_INFINITE_PINGS': 2,
'IGNORE_1WEEk_EDITING_LIMIT': 2,
'ADMIN_ADD': 3,
'ADMIN_REMOVE': 3,

View File

@ -613,7 +613,8 @@ def toggle_comment_nsfw(cid, v):
def edit_comment(cid, v):
c = get_comment(cid, v=v)
if time.time() - c.created_utc > 7*24*60*60 and not (c.post and c.post.private):
if time.time() - c.created_utc > 7*24*60*60 and not (c.post and c.post.private) \
and v.admin_level < PERMS["IGNORE_1WEEk_EDITING_LIMIT"]:
abort(403, "You can't edit comments older than 1 week!")
if c.author_id != v.id: abort(403)

View File

@ -970,8 +970,8 @@ def edit_post(pid, v):
if not v.can_edit(p): 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']):
if time.time() - p.created_utc > 7*24*60*60 and not p.private \
and v.admin_level < PERMS["IGNORE_1WEEk_EDITING_LIMIT"]:
abort(403, "You can't edit posts older than 1 week!")
title = sanitize_raw_title(request.values.get("title", ""))