add IGNORE_1WEEk_EDITING_LIMIT perm
parent
d2a888a82f
commit
a76729cda5
|
@ -467,6 +467,7 @@ PERMS = { # Minimum admin_level to perform action.
|
||||||
'BUY_GHOST_AWARD': 2,
|
'BUY_GHOST_AWARD': 2,
|
||||||
'LOTTERY_VIEW_PARTICIPANTS': 2,
|
'LOTTERY_VIEW_PARTICIPANTS': 2,
|
||||||
'POST_COMMENT_INFINITE_PINGS': 2,
|
'POST_COMMENT_INFINITE_PINGS': 2,
|
||||||
|
'IGNORE_1WEEk_EDITING_LIMIT': 2,
|
||||||
|
|
||||||
'ADMIN_ADD': 3,
|
'ADMIN_ADD': 3,
|
||||||
'ADMIN_REMOVE': 3,
|
'ADMIN_REMOVE': 3,
|
||||||
|
|
|
@ -613,7 +613,8 @@ def toggle_comment_nsfw(cid, v):
|
||||||
def edit_comment(cid, v):
|
def edit_comment(cid, v):
|
||||||
c = get_comment(cid, v=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!")
|
abort(403, "You can't edit comments older than 1 week!")
|
||||||
|
|
||||||
if c.author_id != v.id: abort(403)
|
if c.author_id != v.id: abort(403)
|
||||||
|
|
|
@ -970,8 +970,8 @@ def edit_post(pid, v):
|
||||||
if not v.can_edit(p): abort(403)
|
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
|
# 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
|
if time.time() - p.created_utc > 7*24*60*60 and not p.private \
|
||||||
and not v.admin_level >= PERMS['POST_EDITING']):
|
and v.admin_level < PERMS["IGNORE_1WEEk_EDITING_LIMIT"]:
|
||||||
abort(403, "You can't edit posts older than 1 week!")
|
abort(403, "You can't edit posts older than 1 week!")
|
||||||
|
|
||||||
title = sanitize_raw_title(request.values.get("title", ""))
|
title = sanitize_raw_title(request.values.get("title", ""))
|
||||||
|
|
Loading…
Reference in New Issue