I just imported all the emails from an old sympa mailing list (using the MBOX import guide), but some of the posts seem to be displayed out of order. However, the date stamps are correct, so I’m not sure why this is happening. I need to fix this over all imported threads, of which there are fairly many.
You can look at this post for an example of what I’m talking about, the date stamps go Jul 7, Jul 7, Jul 9, Jul 16, Aug 1, and back to Jul 7).
Is there any command I can run to re-sort the posts by date or other suggestions?
There’s a rake task for sorting posts within a topic, but I do not recommend using it on more than a couple of topics as long as you still have a chance to fix the order within the import script.
Out of curiosity: Did you follow Importing mailing lists (mbox, Listserv, Google Groups, emails, ...)?
Would you mind sending me a PM with the source of all the emails in that topic? I’d like to take a look why the import script isn’t sorting the emails correctly.
Thanks for the mbox file. It looks like the sorting never really worked. It must have been luck that all the mbox files I imported in the past had the correct order.
Anyway, I fixed it in https://github.com/discourse/discourse/commit/ac743dab104d76d508a5a930c8d45f085c144ab2
Please bear in mind that it’s still possible for some messages to be appear to be in the wrong order. That’s because the post date reflects the value of the email’s
Date header. It’s possible that the email client used the wrong date when sending an email. The import script determines the primary sort order by looking at the
References header in order to prevent replies from showing up before any email it referenced.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.