Commit eece7f34 authored by Ragnar Hardarson's avatar Ragnar Hardarson Committed by Phil Hughes

Do not render two project size warnings

above_size_limit_warning and namespace_storage_limit_alert
both notify the user that a project has reached the size limit.
Let us only render one at a time.
parent 6382d3dc
- size_checker = project.repository_size_checker
- if size_checker.above_size_limit?
- if size_checker.above_size_limit? && !project&.namespace&.additional_repo_storage_by_namespace_enabled?
.gl-alert.gl-alert-warning.gl-display-none.gl-display-sm-block
= sprite_icon('warning', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
= size_checker.error_message.above_size_limit_message
......@@ -18,11 +18,31 @@ RSpec.describe ProjectsController do
subject { get :show, params: { namespace_id: public_project.namespace.path, id: public_project.path } }
context 'with additional_repo_storage_by_namespace_enabled? enabled' do
before do
allow_any_instance_of(EE::Namespace).to receive(:additional_repo_storage_by_namespace_enabled?).and_return(true)
end
it 'does not show over size limit warning when above_size_limit' do
allow_next_instance_of(Gitlab::RepositorySizeChecker) do |checker|
expect(checker).to receive(:above_size_limit?).and_return(true)
end
subject
expect(response.body).not_to match(/The size of this repository.+exceeds the limit/)
end
end
context 'with additional_repo_storage_by_namespace_enabled? disabled' do
before do
allow_any_instance_of(EE::Namespace).to receive(:additional_repo_storage_by_namespace_enabled?).and_return(false)
end
it 'shows the over size limit warning message if above_size_limit' do
allow_next_instance_of(Gitlab::RepositorySizeChecker) do |checker|
expect(checker).to receive(:above_size_limit?).and_return(true)
end
allow(controller).to receive(:current_user).and_return(user)
subject
......@@ -34,6 +54,7 @@ RSpec.describe ProjectsController do
expect(response.body).not_to match(/The size of this repository.+exceeds the limit/)
end
end
context 'namespace storage limit' do
let(:namespace) { public_project.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