From 5cfc89db802e3cb458557160347bad3d4270c053 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 25 Feb 2024 01:43:38 +0200 Subject: [PATCH] change editing comments limit from a month to a week --- files/helpers/config/const.py | 6 +++--- files/routes/comments.py | 5 ++--- files/routes/posts.py | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 540532394b..cdcb5b35e0 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -182,7 +182,7 @@ PERMS = { # Minimum admin_level to perform action. 'USER_CHANGE_FLAIR': 2, 'LOTTERY_VIEW_PARTICIPANTS': 2, 'POST_COMMENT_INFINITE_PINGS': 2, - 'IGNORE_1MONTH_EDITING_LIMIT': 2, + 'IGNORE_EDITING_LIMIT': 2, 'ORGIES': 2, 'POST_BETS': 2, 'POST_BETS_DISTRIBUTE': 2, @@ -574,7 +574,7 @@ GTIX_ID = 0 CURRENCY_TRANSFER_ID = 5 IMMUNE_TO_NEGATIVE_AWARDS = {} -EXEMPT_FROM_1MONTH_EDITING_LIMIT = {} +EXEMPT_FROM_EDITING_LIMIT = {} PINNED_POSTS_IDS = {} MODMAIL_ID = 2 @@ -674,7 +674,7 @@ if SITE in {'rdrama.net', 'staging.rdrama.net'}: BOT_SYMBOL_HIDDEN = {12125, 16049, 23576} ANTISPAM_BYPASS_IDS = BOT_SYMBOL_HIDDEN | {1703, 13427, 15014, 24197, 25816} - EXEMPT_FROM_1MONTH_EDITING_LIMIT = {1048} + EXEMPT_FROM_EDITING_LIMIT = {1048} AUTOJANNY_ID = 1046 SNAPPY_ID = 261 diff --git a/files/routes/comments.py b/files/routes/comments.py index 35b426f43c..32c5869132 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -590,9 +590,8 @@ def toggle_comment_nsfw(cid, v): def edit_comment(cid, v): c = get_comment(cid, v=v) - if time.time() - c.created_utc > 31*24*60*60 and not (c.post and c.post.draft) \ - and v.admin_level < PERMS["IGNORE_1MONTH_EDITING_LIMIT"] and v.id not in EXEMPT_FROM_1MONTH_EDITING_LIMIT: - abort(403, "You can't edit comments older than 1 month!") + if time.time() - c.created_utc > 7*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: + abort(403, "You can't edit comments older than 1 week!") if c.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_EDITING']: abort(403) diff --git a/files/routes/posts.py b/files/routes/posts.py index b809dce4e9..8060e4d251 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1030,8 +1030,7 @@ 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 > 31*24*60*60 and not p.draft \ - and v.admin_level < PERMS["IGNORE_1MONTH_EDITING_LIMIT"] and v.id not in EXEMPT_FROM_1MONTH_EDITING_LIMIT: + if time.time() - p.created_utc > 31*24*60*60 and not p.draft and v.admin_level < PERMS["IGNORE_EDITING_LIMIT"] and v.id not in EXEMPT_FROM_EDITING_LIMIT: abort(403, "You can't edit posts older than 1 month!") title = request.values.get("title", "").strip()