Repository navigation
Conversation
Liquid's `sort_natural` filter only makes the comparison case-insensitive, it still compares tag names as strings, so `v2.0.20` was listed before `v2.0.2` and `v2.0.9` ended up at the top of the list. Sort on the release `created_at` date instead. This is an ISO 8601 timestamp, so a string sort orders it correctly. The `published_at` date is not usable as `v1.5.0` was created in 2012, but only published in 2021. Fixes WordPress#886
Member
|
@yaman-694 Thank you for your efforts.
This may well happen in the future if security issues are addressed and fixes would be backported to older Requests versions (before a PHP version drop), so to me, this PR, while a creative solution, does not actually address the described task. Having said that, I can imagine a discussion could be had about what the sort order should be if releases are tagged in multiple minor/majors, but if so, that discussion should be had in the ticket #886. |
Author
|
Thanks @jrfnl, for reviewing. Your point make sense happy to be a part of the discussion |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
This is a:
Context
Fixes #886
The "Previous Versions" list on the download page is not in version order.
PR #884 switched the filter from
sorttosort_natural, but that did not fix it.Detailed Description
Liquid's
sort_naturalfilter only makes the comparison case-insensitive.It still compares the tag names as strings, so
v2.0.20is listed beforev2.0.2, andv2.0.9ends up at the top of the list.This PR sorts on the release
created_atdate instead.That value is an ISO 8601 timestamp, so a plain string sort orders it correctly.
I did not use
published_at, asv1.5.0was created in 2012 but only published in 2021, so it would be listed betweenv1.8.0andv2.0.0.I checked the
created_atdate of all current releases via the GitHub API and the date order matches the version order for every one of them.Rendered order before (local
jekyll serve):Rendered order after:
Note: sorting by date assumes releases are tagged in version order.
If a release for an older branch is ever tagged after a newer one, it would be listed by date.
Quality assurance