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 - 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 .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') = sprite_icon('warning', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
= size_checker.error_message.above_size_limit_message = size_checker.error_message.above_size_limit_message
...@@ -18,21 +18,42 @@ RSpec.describe ProjectsController do ...@@ -18,21 +18,42 @@ RSpec.describe ProjectsController do
subject { get :show, params: { namespace_id: public_project.namespace.path, id: public_project.path } } subject { get :show, params: { namespace_id: public_project.namespace.path, id: public_project.path } }
it 'shows the over size limit warning message if above_size_limit' do context 'with additional_repo_storage_by_namespace_enabled? enabled' do
allow_next_instance_of(Gitlab::RepositorySizeChecker) do |checker| before do
expect(checker).to receive(:above_size_limit?).and_return(true) allow_any_instance_of(EE::Namespace).to receive(:additional_repo_storage_by_namespace_enabled?).and_return(true)
end end
allow(controller).to receive(:current_user).and_return(user)
subject 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).to match(/The size of this repository.+exceeds the limit/) expect(response.body).not_to match(/The size of this repository.+exceeds the limit/)
end
end end
it 'does not show an over size warning if not above_size_limit' do context 'with additional_repo_storage_by_namespace_enabled? disabled' do
subject before do
allow_any_instance_of(EE::Namespace).to receive(:additional_repo_storage_by_namespace_enabled?).and_return(false)
end
expect(response.body).not_to match(/The size of this repository.+exceeds the limit/) 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
subject
expect(response.body).to match(/The size of this repository.+exceeds the limit/)
end
it 'does not show an over size warning if not above_size_limit' do
subject
expect(response.body).not_to match(/The size of this repository.+exceeds the limit/)
end
end end
context 'namespace storage limit' do context 'namespace storage limit' 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