Added asyncCheck to discarded future and moved out of template.

This commit is contained in:
Dominik Picheta 2015-08-23 22:38:57 +01:00
commit 633435a2fe

View file

@ -491,10 +491,6 @@ template writeToDb(c, cr, setPostId: expr) =
if setPostId: if setPostId:
c.postId = retID.int c.postId = retID.int
template sendToMailingList(c) =
# send comment to a mailing list (if configured to do so)
discard sendMailToMailingList(c.config, c.username, c.email, subject, content)
proc edit(c: var TForumData, postId: int): bool = proc edit(c: var TForumData, postId: int): bool =
checkLogin(c) checkLogin(c)
if c.isPreview: if c.isPreview:
@ -545,7 +541,8 @@ proc reply(c: var TForumData): bool =
exec(db, sql"update thread set modified = DATETIME('now') where id = ?", exec(db, sql"update thread set modified = DATETIME('now') where id = ?",
$c.threadId) $c.threadId)
sendToMailingList(c) asyncCheck sendMailToMailingList(c.config, c.username, c.email,
subject, content)
result = true result = true
proc newThread(c: var TForumData): bool = proc newThread(c: var TForumData): bool =
@ -564,7 +561,8 @@ proc newThread(c: var TForumData): bool =
writeToDb(c, crCreate, false) writeToDb(c, crCreate, false)
discard tryExec(db, sql"insert into post_fts(post_fts) values('optimize')") discard tryExec(db, sql"insert into post_fts(post_fts) values('optimize')")
discard tryExec(db, sql"insert into post_fts(thread_fts) values('optimize')") discard tryExec(db, sql"insert into post_fts(thread_fts) values('optimize')")
sendToMailingList(c) asyncCheck sendMailToMailingList(c.config, c.username, c.email,
subject, content)
result = true result = true
proc login(c: var TForumData, name, pass: string): bool = proc login(c: var TForumData, name, pass: string): bool =