diff --git a/data/model/repository.py b/data/model/repository.py index 36335f3eb..fa4d013c9 100644 --- a/data/model/repository.py +++ b/data/model/repository.py @@ -655,17 +655,6 @@ def confirm_email_authorization_for_repo(code): return found -def list_popular_public_repos(action_count_threshold, time_span, repo_kind='image'): - cutoff = datetime.now() - time_span - return (Repository.select(Namespace.username, Repository.name) - .join(Namespace, on=(Repository.namespace_user == Namespace.id)).switch(Repository) - .join(RepositoryActionCount).where(RepositoryActionCount.date >= cutoff, - Repository.visibility == get_public_repo_visibility(), - Repository.kind == Repository.kind.get_id(repo_kind)) - .group_by(RepositoryActionCount.repository, Repository.name, Namespace.username) - .having(fn.Sum(RepositoryActionCount.count) >= action_count_threshold).tuples()) - - def is_empty(namespace_name, repository_name): """ Returns if the repository referenced by the given namespace and name is empty. If the repo doesn't exist, returns True. diff --git a/data/model/test/test_repository.py b/data/model/test/test_repository.py index c82816cc6..3be61a6e2 100644 --- a/data/model/test/test_repository.py +++ b/data/model/test/test_repository.py @@ -46,9 +46,3 @@ def test_search_pagination(query, authed_username, initialized_db): next_repos = get_filtered_matching_repositories(query, filter_username=authed_username, offset=1) assert repositories[0].id != next_repos[0].id assert repositories[1].id == next_repos[0].id - - -def test_popular_repo_list(initialized_db): - onlypublic = model.repository.list_popular_public_repos(0, timedelta(weeks=1)) - assert len(onlypublic) == 1 - assert onlypublic[0] == ('public', 'publicrepo') diff --git a/endpoints/web.py b/endpoints/web.py index 515187597..2cbc13ecb 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -332,15 +332,6 @@ def robots(): return robots_txt -@web.route('/sitemap.xml', methods=['GET']) -def sitemap(): - popular_repo_tuples = model.repository.list_popular_public_repos(50, timedelta(weeks=1)) - xml = make_response(render_template('sitemap.xml', public_repos=popular_repo_tuples, - baseurl=get_app_url())) - xml.headers['Content-Type'] = 'application/xml' - return xml - - @web.route('/buildlogs/', methods=['GET']) @route_show_if(features.BUILD_SUPPORT) @process_auth_or_cookie diff --git a/test/test_endpoints.py b/test/test_endpoints.py index 9140e3e5f..a46794a6a 100644 --- a/test/test_endpoints.py +++ b/test/test_endpoints.py @@ -228,9 +228,6 @@ class WebEndpointTestCase(EndpointTestCase): def test_robots(self): self.getResponse('web.robots') - def test_sitemap(self): - self.getResponse('web.sitemap') - def test_repo_view(self): self.getResponse('web.repository', path='devtable/simple')