give "you need to change something" error

master
Aevann 2024-03-08 00:02:25 +02:00
parent d4ead1150f
commit fa80540fc6
2 changed files with 10 additions and 0 deletions

View File

@ -683,6 +683,8 @@ def edit_comment(cid, v):
g.db.flush()
gevent.spawn(postprocess_comment, c.body, c.body_html, c.id)
else:
abort(400, "You need to change something!")
return {

View File

@ -1055,6 +1055,8 @@ def edit_post(pid, v):
for x in notify_users:
add_notif(cid, x, text, pushnotif_url=p.permalink)
changed = False
if title != p.title:
title_html = filter_emojis_only(title, golden=False, obj=p, author=p.author)
@ -1068,6 +1070,8 @@ def edit_post(pid, v):
p.title = title
p.title_html = title_html
changed = True
body = process_files(request.files, v, body).strip()
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)')
@ -1093,6 +1097,10 @@ def edit_post(pid, v):
gevent.spawn(postprocess_post, p.url, p.body, p.body_html, p.id, False, True)
changed = True
if not changed:
abort(400, "You need to change something!")
if not p.draft and not complies_with_chud(p):
abort(403, f'You have to include "{p.author.chud_phrase}" in your post!')