Show newthread error underneath subject.

This commit is contained in:
Dominik Picheta 2018-05-15 20:46:42 +01:00
commit f6e6929c25
2 changed files with 7 additions and 0 deletions

View file

@ -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"])

View file

@ -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"