From 73742260eac42a5b5fdc52918aea2910cf00401a Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 27 Jul 2023 18:53:01 -0500 Subject: [PATCH] increase length limit for comments from 10k to 50k unfiltered or 500k filtered --- files/helpers/config/const.py | 3 ++- files/routes/comments.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 1305f7b62..16f1de03d 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -92,7 +92,8 @@ SUBMISSION_FLAIR_LENGTH_MAXIMUM: Final[int] = 350 SUBMISSION_TITLE_LENGTH_MAXIMUM: Final[int] = 500 SUBMISSION_URL_LENGTH_MAXIMUM: Final[int] = 2048 SUBMISSION_BODY_LENGTH_MAXIMUM: Final[int] = 20000 -COMMENT_BODY_LENGTH_MAXIMUM: Final[int] = 10000 +COMMENT_BODY_LENGTH_MAXIMUM: Final[int] = 500000 +COMMENT_BODY_LENGTH_MAXIMUM_UNFILTERED: Final[int] = 50000 MESSAGE_BODY_LENGTH_MAXIMUM: Final[int] = 10000 CSS_LENGTH_MAXIMUM: Final[int] = 4000 diff --git a/files/routes/comments.py b/files/routes/comments.py index 82a8f0b88..a6ae06a59 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -203,6 +203,10 @@ def api_comment(v): is_filtered = v.should_comments_be_filtered() + if (v.admin_level <= PERMS['POST_COMMENT_MODERATION'] + and len(body) > COMMENT_BODY_LENGTH_MAXIMUM_UNFILTERED): + is_filtered = True + c = Comment(author_id=v.id, parent_submission=parent_post.id, parent_comment_id=parent_comment_id, @@ -241,6 +245,9 @@ def api_comment(v): if replying_to_blocked: message = "This user has blocked you. You are still welcome to reply " \ "but you will be held to a higher standard of civility than you would be otherwise" + elif (v.admin_level <= PERMS['POST_COMMENT_MODERATION'] + and len(body) > COMMENT_BODY_LENGTH_MAXIMUM_UNFILTERED): + message = "Your comment has been submitted but is a bit long, so it's pending approval." else: message = None return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True, parent_level=level), "message": message}