Commit 18d45414 authored by Stan Hu's avatar Stan Hu

Merge branch 'zj-race-condition-pending-delete' into 'master'

Project#show on projects pending deletion will 404

fixes #17508

See merge request !4156
parents f9bb9151 be613de2
...@@ -11,6 +11,7 @@ v 8.9.0 (unreleased) ...@@ -11,6 +11,7 @@ v 8.9.0 (unreleased)
- Fix issues filter when ordering by milestone - Fix issues filter when ordering by milestone
- Todos will display target state if issuable target is 'Closed' or 'Merged' - Todos will display target state if issuable target is 'Closed' or 'Merged'
- Remove 'main language' feature - Remove 'main language' feature
- Projects pending deletion will render a 404 page
- Measure queue duration between gitlab-workhorse and Rails - Measure queue duration between gitlab-workhorse and Rails
v 8.8.3 v 8.8.3
......
...@@ -26,7 +26,7 @@ class Projects::ApplicationController < ApplicationController ...@@ -26,7 +26,7 @@ class Projects::ApplicationController < ApplicationController
project_path = "#{namespace}/#{id}" project_path = "#{namespace}/#{id}"
@project = Project.find_with_namespace(project_path) @project = Project.find_with_namespace(project_path)
if @project && can?(current_user, :read_project, @project) if can?(current_user, :read_project, @project) && !@project.pending_delete?
if @project.path_with_namespace != project_path if @project.path_with_namespace != project_path
redirect_to request.original_url.gsub(project_path, @project.path_with_namespace) redirect_to request.original_url.gsub(project_path, @project.path_with_namespace)
end end
......
...@@ -115,6 +115,17 @@ describe ProjectsController do ...@@ -115,6 +115,17 @@ describe ProjectsController do
expect(public_project_with_dot_atom).not_to be_valid expect(public_project_with_dot_atom).not_to be_valid
end end
end end
context 'when the project is pending deletions' do
it 'renders a 404 error' do
project = create(:project, pending_delete: true)
sign_in(user)
get :show, namespace_id: project.namespace.path, id: project.path
expect(response.status).to eq 404
end
end
end end
describe "#update" do describe "#update" 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