From b2beb40444594735311672ba99d16c7181953d2a Mon Sep 17 00:00:00 2001 From: osmarks Date: Sun, 25 Apr 2021 13:53:09 +0100 Subject: [PATCH] Ignore empty messages --- src/xenotime.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xenotime.nim b/src/xenotime.nim index 1e156db..48c2f6e 100644 --- a/src/xenotime.nim +++ b/src/xenotime.nim @@ -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)