Ignore empty messages

This commit is contained in:
osmarks 2021-04-25 13:53:09 +01:00
parent 5ad0e0927c
commit b2beb40444
1 changed files with 4 additions and 0 deletions

View File

@ -135,6 +135,10 @@ proc newThreadForm(ctx: AppContext) {.async.} =
proc submitPost(ctx: AppContext) {.async.} =
let title = ctx.getFormParams("thread-title")
if ctx.getFormParams("content") == "" or (title == "" and ctx.getFormParams("thread-id") == ""):
ctx.flash("Please actually have content.", FlashLevel.Warning)
resp redirect(ctx.request.headers["referer"], Http303)
return
if ctx.user.isSome:
ctx.db.transaction:
let threadID = if title != "": domain.postThread(ctx.db, title, ctx.user.get.id)