disable editing for removed conent per wpd janny poll

master
Aevann 2024-10-21 23:02:16 +03:00
parent 0ee1652f74
commit 92683598b3
2 changed files with 6 additions and 0 deletions

View File

@ -685,6 +685,9 @@ def edit_comment(cid, v):
if time.time() - c.created_utc > 3*24*60*60 and not (c.post and c.post.draft) and v.admin_level < PERMS["IGNORE_EDITING_LIMIT"] and v.id not in EXEMPT_FROM_EDITING_LIMIT:
stop(403, "You can't edit comments older than 3 days!")
if c.is_banned:
stop(403, "You can't edit comments that were removed by admins!")
if c.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_EDITING']:
stop(403)

View File

@ -1068,6 +1068,9 @@ def edit_post(pid, v):
if time.time() - p.created_utc > days*24*60*60 and not p.draft and v.admin_level < PERMS["IGNORE_EDITING_LIMIT"] and v.id not in EXEMPT_FROM_EDITING_LIMIT:
stop(403, f"You can't edit posts older than {days} days!")
if p.is_banned:
stop(403, "You can't edit posts that were removed by admins!")
title = request.values.get("title", "").strip()
if len(title) > POST_TITLE_LENGTH_LIMIT:
stop(400, f'Post title is too long (max {POST_TITLE_LENGTH_LIMIT} characters)')