Commit 25551671 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '18424-archived-corrupted-repo-not-displaying' into 'master'

Fix archived corrupted projects not displaying on admin panel with...

Closes #18424

See merge request gitlab-org/gitlab!25171
parents 3a21e139 47f5da4f
...@@ -9,6 +9,11 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -9,6 +9,11 @@ class Admin::ProjectsController < Admin::ApplicationController
def index def index
params[:sort] ||= 'latest_activity_desc' params[:sort] ||= 'latest_activity_desc'
@sort = params[:sort] @sort = params[:sort]
if params[:last_repository_check_failed].present? && params[:archived].nil?
params[:archived] = true
end
@projects = Admin::ProjectsFinder.new(params: params, current_user: current_user).execute @projects = Admin::ProjectsFinder.new(params: params, current_user: current_user).execute
respond_to do |format| respond_to do |format|
......
---
title: Fix archived corrupted projects not displaying in admin
merge_request: 25171
author: erickcspice
type: fixed
...@@ -24,6 +24,18 @@ describe Admin::ProjectsController do ...@@ -24,6 +24,18 @@ describe Admin::ProjectsController do
expect(response.body).not_to match(project.name) expect(response.body).not_to match(project.name)
end end
it 'retrieves archived and non archived corrupted projects when last_repository_check_failed is true' do
archived_corrupted_project = create(:project, :public, :archived, :last_repository_check_failed, name: 'CorruptedArchived', path: 'A')
corrupted_project = create(:project, :public, :last_repository_check_failed, name: 'CorruptedOnly', path: 'C')
get :index, params: { last_repository_check_failed: true }
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).not_to match(project.name)
expect(response.body).to match(archived_corrupted_project.name)
expect(response.body).to match(corrupted_project.name)
end
it 'does not respond with projects pending deletion' do it 'does not respond with projects pending deletion' do
pending_delete_project = create(:project, pending_delete: true) pending_delete_project = create(:project, pending_delete: true)
......
...@@ -114,6 +114,10 @@ FactoryBot.define do ...@@ -114,6 +114,10 @@ FactoryBot.define do
archived { true } archived { true }
end end
trait :last_repository_check_failed do
last_repository_check_failed { true }
end
storage_version { Project::LATEST_STORAGE_VERSION } storage_version { Project::LATEST_STORAGE_VERSION }
trait :legacy_storage do trait :legacy_storage do
......
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