Only duplicate title into body for Polls if it's not already in there

This commit is contained in:
freamon 2024-05-31 21:10:09 +01:00
parent 7cfe89a92e
commit ae68eecb65

View file

@ -426,7 +426,7 @@ def save_post(form, post: Post, type: str):
elif type == 'poll': elif type == 'poll':
post.title = form.poll_title.data post.title = form.poll_title.data
post.body = form.poll_title.data + '\n' + form.poll_body.data post.body = form.poll_title.data + '\n' + form.poll_body.data if post.title not in form.poll_body.data else form.poll_body.data
post.body_html = markdown_to_html(post.body) post.body_html = markdown_to_html(post.body)
post.type = POST_TYPE_POLL post.type = POST_TYPE_POLL
else: else: