Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addons: return all active versions on single version project #11727

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions readthedocs/proxito/tests/test_hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,8 @@ def test_flyout_single_version_project(self):
},
)
assert r.status_code == 200

expected = []
assert r.json()["versions"]["active"] == expected
expected = ["latest"]
assert [v["slug"] for v in r.json()["versions"]["active"]] == expected

expected = {
"pdf": "https://project.dev.readthedocs.io/_/downloads/en/latest/pdf/",
Expand Down
14 changes: 7 additions & 7 deletions readthedocs/proxito/views/hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,14 @@ def _v1(self, project, version, build, filename, url, request):
# projects that don't have one already
AddonsConfig.objects.get_or_create(project=project)

if project.supports_multiple_versions:
versions_active_built_not_hidden = (
self._get_versions(request, project)
.select_related("project")
.order_by("-slug")
)
sorted_versions_active_built_not_hidden = versions_active_built_not_hidden
versions_active_built_not_hidden = (
self._get_versions(request, project)
.select_related("project")
.order_by("-slug")
)
sorted_versions_active_built_not_hidden = versions_active_built_not_hidden

if project.supports_multiple_versions:
if (
project.addons.flyout_sorting
== ADDONS_FLYOUT_SORTING_SEMVER_READTHEDOCS_COMPATIBLE
Expand Down