Commit 72682bd1 authored by Douwe Maan's avatar Douwe Maan Committed by Simon Knox

Merge branch '35435-pending-delete-project-error-in-admin-interface-fix' into 'master'

Pending delete projects no longer return 500 error in Admins projects view

Closes #35435

See merge request !13389
parent 2007cca9
......@@ -18,7 +18,7 @@ class Admin::ProjectsFinder
end
def execute
items = Project.with_statistics
items = Project.without_deleted.with_statistics
items = items.in_namespace(namespace_id) if namespace_id.present?
items = items.where(visibility_level: visibility_level) if visibility_level.present?
items = items.with_push if with_push.present?
......
---
title: Project pending delete no longer return 500 error in admins projects view
merge_request: 13389
author:
......@@ -12,12 +12,24 @@ describe Admin::ProjectsController do
it 'retrieves the project for the given visibility level' do
get :index, visibility_level: [Gitlab::VisibilityLevel::PUBLIC]
expect(response.body).to match(project.name)
end
it 'does not retrieve the project' do
get :index, visibility_level: [Gitlab::VisibilityLevel::INTERNAL]
expect(response.body).not_to match(project.name)
end
it 'does not respond with projects pending deletion' do
pending_delete_project = create(:project, pending_delete: true)
get :index
expect(response).to have_http_status(200)
expect(response.body).not_to match(pending_delete_project.name)
expect(response.body).to match(project.name)
end
end
end
......@@ -38,6 +38,12 @@ describe Admin::ProjectsFinder do
it { is_expected.to match_array([shared_project, public_project, internal_project, private_project]) }
end
context 'with pending delete project' do
let!(:pending_delete_project) { create(:project, pending_delete: true) }
it { is_expected.not_to include(pending_delete_project) }
end
context 'filter by namespace_id' do
let(:namespace) { create(:namespace) }
let!(:project_in_namespace) { create(:project, namespace: namespace) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment