diff --git a/readthedocs/proxito/tests/test_hosting.py b/readthedocs/proxito/tests/test_hosting.py index bcda4a0383f..d9acd5a0fa0 100644 --- a/readthedocs/proxito/tests/test_hosting.py +++ b/readthedocs/proxito/tests/test_hosting.py @@ -816,6 +816,22 @@ def test_number_of_queries_url_subproject(self): ) assert r.status_code == 200 + # Test parent project has fewer queries + with self.assertNumQueries(26): + r = self.client.get( + reverse("proxito_readthedocs_docs_addons"), + { + "url": "https://project.dev.readthedocs.io/en/latest/", + "client-version": "0.6.0", + "api-version": "1.0.0", + }, + secure=True, + headers={ + "host": "project.dev.readthedocs.io", + }, + ) + assert r.status_code == 200 + def test_number_of_queries_url_translations(self): # Create multiple translations to be shown in the flyout for language in ["ja", "es", "ru", "pt-br"]: diff --git a/readthedocs/proxito/views/hosting.py b/readthedocs/proxito/views/hosting.py index 564ee05f928..0b62559cbf3 100644 --- a/readthedocs/proxito/views/hosting.py +++ b/readthedocs/proxito/views/hosting.py @@ -525,7 +525,7 @@ def _v1(self, project, version, build, filename, url, request): f"subprojects:{project.slug}/{version.slug}", ] ) - if project.superprojects.exists(): + elif project.superprojects.exists(): superproject = project.superprojects.first().parent data["addons"]["search"]["filters"].append( [