[bugfix] fix unordered favorites (#1245)

* [bugfix] fix unordered favorites

* add test for favouritesget

* add license to new test files
This commit is contained in:
Christoph Voigt 2022-12-13 12:33:49 +01:00 committed by GitHub
commit 8703933df4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 202 additions and 1 deletions

View file

@ -233,7 +233,7 @@ func (t *timelineDB) GetFavedTimeline(ctx context.Context, accountID string, max
// Sort by favourite ID rather than status ID
slices.SortFunc(faves, func(a, b *gtsmodel.StatusFave) bool {
return b.CreatedAt.Before(a.CreatedAt)
return a.ID > b.ID
})
statuses := make([]*gtsmodel.Status, 0, len(faves))