a final solution to the @jannies question

pull/225/head
Aevann 2024-02-25 01:19:37 +02:00
parent 964db1d6cf
commit 01b508ae91
2 changed files with 7 additions and 0 deletions

View File

@ -167,6 +167,7 @@ def comment(v):
if len(body) > COMMENT_BODY_LENGTH_LIMIT:
abort(400, f'Comment body is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)')
body = body.replace('@jannies', '!jannies')
if not posting_to_post or post_target.id not in ADMIGGER_THREADS:
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
@ -606,6 +607,8 @@ def edit_comment(cid, v):
if len(body) < 1 and not (request.files.get("file") and not g.is_tor):
abort(400, "You have to actually type something!")
body = body.replace('@jannies', '!jannies')
if body != c.body or request.files.get("file") and not g.is_tor:
if c.author.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
abort(403, "You have to type more than 280 characters!")

View File

@ -471,6 +471,8 @@ def submit_post(v, hole=None):
if len(body) > POST_BODY_LENGTH_LIMIT(g.v):
abort(400, f'Post body is too long (max {POST_BODY_LENGTH_LIMIT(g.v)} characters)')
body = body.replace('@jannies', '!jannies')
if not title:
abort(400, "Please enter a better title!")
@ -1040,6 +1042,8 @@ def edit_post(pid, v):
if len(body) > POST_BODY_LENGTH_LIMIT(g.v):
abort(400, f'Post body is too long (max {POST_BODY_LENGTH_LIMIT(g.v)} characters)')
body = body.replace('@jannies', '!jannies')
if p.author.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
abort(403, "You have to type more than 280 characters!")
elif p.author.bird and len(body) > 140: