mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
BUGFIX: make sure we properly set topics.last_posted_at when importing from Vanilla
This commit is contained in:
parent
f111e4ba56
commit
90edaec9f0
@ -240,14 +240,15 @@ class Vanilla < Thor
|
|||||||
@discussions.each do |discussion|
|
@discussions.each do |discussion|
|
||||||
next unless topic_id = discussion[:new_id]
|
next unless topic_id = discussion[:new_id]
|
||||||
|
|
||||||
# HACK to make sure bumped_at is properly set
|
# HACK: make sure both bumped_at and last_posted_at are properly set
|
||||||
|
|
||||||
sql = <<-SQL
|
sql = <<-SQL
|
||||||
UPDATE topics
|
UPDATE topics
|
||||||
SET views = :views,
|
SET views = :views,
|
||||||
closed = :closed,
|
closed = :closed,
|
||||||
pinned_at = :pinned_at,
|
pinned_at = :pinned_at,
|
||||||
bumped_at = (SELECT created_at FROM posts WHERE topic_id = :topic_id ORDER BY created_at DESC LIMIT 1)
|
last_posted_at = (SELECT MAX(created_at) FROM posts WHERE topic_id = :topic_id)
|
||||||
|
bumped_at = (SELECT MAX(created_at) FROM posts WHERE topic_id = :topic_id)
|
||||||
WHERE id = :topic_id
|
WHERE id = :topic_id
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user