diff --git a/forum.nim b/forum.nim index a15b6e8..8881498 100644 --- a/forum.nim +++ b/forum.nim @@ -1120,6 +1120,9 @@ proc executeNewThread(c: TForumData, subject, msg: string): (int64, int64) = if subject.len > 100: raise newForumError("Subject is too long", @["subject"]) + if msg.len == 0: + raise newForumError("Message is empty", @["msg"]) + if not validateRst(c, msg): raise newForumError("Message needs to be valid RST", @["msg"]) diff --git a/redesign/newthread.nim b/redesign/newthread.nim index c81f3cf..8ce4623 100644 --- a/redesign/newthread.nim +++ b/redesign/newthread.nim @@ -52,8 +52,12 @@ when defined(js): input(class="form-input", `type`="text", name="username", placeholder="Type the title here", onChange=(e: Event, n: VNode) => onSubjectChange(e, n, state)) + if state.error.isSome(): + p(class="text-error"): + text state.error.get().message renderContent(state.replyBox, none[Thread](), none[Post]()) tdiv(class="footer"): + button(class=class( {"loading": state.loading}, "btn btn-primary"