Handle no replyingTo option better
This commit is contained in:
parent
14a0864d86
commit
2717496bb5
1 changed files with 15 additions and 7 deletions
|
|
@ -457,13 +457,21 @@ proc executeReply(c: TForumData, threadId: int, content: string,
|
||||||
if isLocked == "1":
|
if isLocked == "1":
|
||||||
raise newForumError("Cannot reply to a locked thread.")
|
raise newForumError("Cannot reply to a locked thread.")
|
||||||
|
|
||||||
let retID = insertID(
|
var retID: int64
|
||||||
db,
|
|
||||||
crud(crCreate, "post", "author", "ip", "content", "thread", "replyingTo"),
|
if replyingTo.isSome():
|
||||||
c.userId, c.req.ip, content, $threadId,
|
retID = insertID(
|
||||||
if replyingTo.isSome(): $replyingTo.get()
|
db,
|
||||||
else: "-1"
|
crud(crCreate, "post", "author", "ip", "content", "thread", "replyingTo"),
|
||||||
)
|
c.userId, c.req.ip, content, $threadId, $replyingTo.get()
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
retID = insertID(
|
||||||
|
db,
|
||||||
|
crud(crCreate, "post", "author", "ip", "content", "thread"),
|
||||||
|
c.userId, c.req.ip, content, $threadId
|
||||||
|
)
|
||||||
|
|
||||||
discard tryExec(
|
discard tryExec(
|
||||||
db,
|
db,
|
||||||
crud(crCreate, "post_fts", "id", "content"),
|
crud(crCreate, "post_fts", "id", "content"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue