diff --git a/readthedocs/projects/views/public.py b/readthedocs/projects/views/public.py index 0b61a0ec5db..a9f005516d6 100644 --- a/readthedocs/projects/views/public.py +++ b/readthedocs/projects/views/public.py @@ -287,7 +287,14 @@ def project_versions(request, project_slug): only_active=False, ) active_versions = versions.filter(active=True) + + # Limit inactive versions in case a project has a large number of branches or tags + # Filter inactive versions based on the query string inactive_versions = versions.filter(active=False) + version_filter = request.GET.get('version_filter', '') + if version_filter: + inactive_versions = inactive_versions.filter(verbose_name__icontains=version_filter) + inactive_versions = inactive_versions[:100] # If there's a wiped query string, check the string against the versions # list and display a success message. Deleting directories doesn't know how diff --git a/readthedocs/templates/projects/project_version_list.html b/readthedocs/templates/projects/project_version_list.html index 695770b196e..30be91e3398 100644 --- a/readthedocs/templates/projects/project_version_list.html +++ b/readthedocs/templates/projects/project_version_list.html @@ -78,7 +78,22 @@
{% trans "Active versions are built whenever new code is pushed to that branch or tag." %}
+