kensanata / mastodon-archive

Archive your statuses, favorites and media using the Mastodon API (i.e. login required)
https://alexschroeder.ch/software/Mastodon_Archive
GNU General Public License v3.0
362 stars 33 forks source link

Fix status insertion order when downloading new statuses #74

Closed cutiful closed 2 years ago

cutiful commented 2 years ago

Currently, Mastodon Archive inserts statuses in reverse chronological order on first load. But the next time you run it, it again downloads your new posts in reverse chronological order, and appends them at the end of the array of existing posts. This messes up the order in Meow and in HTML export — if you had never split your archive, you can generate the report and see that the order is wrong. E. g. if you run it at 2021-08-01 for the first time, and then again at 2021-08-05, you'll get the following post order:

This pull request fixes the insertion order. Additionally, it will sort user's own statuses after loading them from existing JSON, so that existing archives, which have been created before the fix, work correctly. Unfortunately, we can't do the same for favourites, because data returned from API only contains the favourited post publication date, but not the date at which the user favourited it.

kensanata commented 2 years ago

It never bothered me because I'm mostly a user of the "text" subcommand for searches. But I like the idea in general!