How to Order Topic Replies in Chronological Order By Default

AI-generated summary

In a support discussion titled “How to Order Topic Replies in Chronological Order By Default,” SethWilliams reports that after migrating from NodeBB to Discourse, imported topic replies appear in reverse chronological order (newest first), while newly created topics display correctly (oldest first). He seeks a way to adjust the default sorting. Firepup650 notes that Discourse doesn’t natively support changing reply order and questions whether the issue affects only imported content. SethWilliams confirms the issue is limited to imported topics. JammyDodger suggests using the rake task rake posts:reorder_posts to fix the order retroactively. pfaffman explains that posts are sorted by topic_id, and the NodeBB importer likely imported posts in reverse chronological order. He recommends either fixing the importer script and reimporting, or using the rake task if reimporting isn’t feasible. The consensus leans toward using the rake task for a quick fix, though a clean reimport is preferred for long-term consistency.

I recently migrated our forum from NodeBB to Discourse. It’s all going great so far, but I’m finding that all of the replies within each topic are automatically sorted in reverse chronological order (the latest reply is at the top, the oldest reply is at the bottom), which seems backward.

I’ve spent about 30 minutes trying to figure out how to show all topic replies in chronological order by default (oldest reply at the top, latest reply at the bottom), but I cannot find where to adjust this in the admin settings.

What am I missing? Where can I adjust how these replies are sorted?

That’s strange, according to multiple topics here, that’s not even possible:

Are all new topics and posts doing this, or only ones from the import?

Good question.

Only the imported topics (which number in the thousands) have their replies sorted in reverse chronological order like this.

The few new ones created after the migration are being sorted chronologically, as they should be.

Is there any way to retroactively sort these imported topic replies chronologically?

I think there’s a rake task that might be of use:

rake posts:reorder_posts

They are displayed in the topic_id order. The problem, I’m guessing, is that somehow the nodeBB importer is getting the data in reverse cron and is therefore creating the posts in reverse order.

You need to see that the import script sorts the posts in chronological order when it does the import. (You’ll also need to wipe the whole database and do the import again).

Good one! Looks like that should work, though if it’s not too late, I’d recommend fixing the import script and starting anew.