Modify the thread title if first post's title is edited.
This commit is contained in:
parent
a472be41d8
commit
72f8126d01
1 changed files with 6 additions and 1 deletions
|
|
@ -426,7 +426,7 @@ proc edit(c: var TForumData, postId: int): bool =
|
||||||
c.threadId = unselectedThread
|
c.threadId = unselectedThread
|
||||||
discard tryExec(db, sql"delete from thread_fts where id not in (select thread from post)")
|
discard tryExec(db, sql"delete from thread_fts where id not in (select thread from post)")
|
||||||
else:
|
else:
|
||||||
# Update corresponding threads modified field.
|
# Update corresponding thread's modified field.
|
||||||
let getModifiedSql = "(select creation from post where post.thread = ?" &
|
let getModifiedSql = "(select creation from post where post.thread = ?" &
|
||||||
" order by creation desc limit 1)"
|
" order by creation desc limit 1)"
|
||||||
let updateSql = sql("update thread set modified=" & getModifiedSql &
|
let updateSql = sql("update thread set modified=" & getModifiedSql &
|
||||||
|
|
@ -441,6 +441,11 @@ proc edit(c: var TForumData, postId: int): bool =
|
||||||
subject, content, $postId)
|
subject, content, $postId)
|
||||||
exec(db, crud(crUpdate, "post_fts", "header", "content"),
|
exec(db, crud(crUpdate, "post_fts", "header", "content"),
|
||||||
subject, content, $postId)
|
subject, content, $postId)
|
||||||
|
# Check if post is the first post of the thread.
|
||||||
|
let rows = db.getAllRows(sql("select id, thread, creation from post " &
|
||||||
|
"where thread = ? order by creation asc"), $c.threadId)
|
||||||
|
if rows[0][0] == $postId:
|
||||||
|
exec(db, crud(crUpdate, "thread", "name"), subject, $c.threadId)
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
proc reply(c: var TForumData): bool =
|
proc reply(c: var TForumData): bool =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue