Commit 54fdfdea authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'fj-replace-snippet-git-message' into 'master'

Update copy when snippet git feature disabled

See merge request gitlab-org/gitlab!28913
parents 75a0b932 e132aa6d
...@@ -121,7 +121,7 @@ module Repositories ...@@ -121,7 +121,7 @@ module Repositories
def snippet_request_allowed? def snippet_request_allowed?
if repo_type.snippet? && Feature.disabled?(:version_snippets, user) if repo_type.snippet? && Feature.disabled?(:version_snippets, user)
Gitlab::AppLogger.info('Snippet access attempt with feature disabled') Gitlab::AppLogger.info('Snippet access attempt with feature disabled')
render plain: 'The project you were looking for could not be found.', status: :not_found render plain: 'Snippet git access is disabled.', status: :forbidden
end end
end end
end end
......
---
title: Update copy when snippet git feature disabled
merge_request: 28913
author:
type: changed
...@@ -109,7 +109,7 @@ module API ...@@ -109,7 +109,7 @@ module API
# group resources based on its IP restrictions # group resources based on its IP restrictions
post "/allowed" do post "/allowed" do
if repo_type.snippet? && Feature.disabled?(:version_snippets, actor.user) if repo_type.snippet? && Feature.disabled?(:version_snippets, actor.user)
break response_with_status(code: 404, success: false, message: 'The project you were looking for could not be found.') break response_with_status(code: 401, success: false, message: 'Snippet git access is disabled.')
end end
# It was moved to a separate method so that EE can alter its behaviour more # It was moved to a separate method so that EE can alter its behaviour more
......
...@@ -145,13 +145,13 @@ describe Repositories::GitHttpController do ...@@ -145,13 +145,13 @@ describe Repositories::GitHttpController do
describe 'GET #info_refs' do describe 'GET #info_refs' do
let(:params) { container_params.merge(service: 'git-upload-pack') } let(:params) { container_params.merge(service: 'git-upload-pack') }
it 'returns 404' do it 'returns 403' do
expect(controller).not_to receive(:access_check) expect(controller).not_to receive(:access_check)
get :info_refs, params: params get :info_refs, params: params
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq "The project you were looking for could not be found." expect(response.body).to eq 'Snippet git access is disabled.'
end end
end end
...@@ -162,13 +162,13 @@ describe Repositories::GitHttpController do ...@@ -162,13 +162,13 @@ describe Repositories::GitHttpController do
allow(controller).to receive(:access_check).and_return(nil) allow(controller).to receive(:access_check).and_return(nil)
end end
it 'returns 404' do it 'returns 403' do
expect(controller).not_to receive(:access_check) expect(controller).not_to receive(:access_check)
post :git_upload_pack, params: params post :git_upload_pack, params: params
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq "The project you were looking for could not be found." expect(response.body).to eq 'Snippet git access is disabled.'
end end
end end
end end
......
...@@ -325,12 +325,12 @@ describe API::Internal::Base do ...@@ -325,12 +325,12 @@ describe API::Internal::Base do
shared_examples 'snippets with disabled feature flag' do shared_examples 'snippets with disabled feature flag' do
context 'when feature flag :version_snippets is disabled' do context 'when feature flag :version_snippets is disabled' do
it 'returns 404' do it 'returns 401' do
stub_feature_flags(version_snippets: false) stub_feature_flags(version_snippets: false)
subject subject
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
end end
......
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