Commit 798f5542 authored by Phil Hughes's avatar Phil Hughes

Merge branch '271399-do-not-render-two-alerts-to-inform-project-is-locked' into 'master'

Do not render two alerts to inform project is locked

See merge request gitlab-org/gitlab!46239
parents 6ffccfdc eece7f34
- 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
...@@ -20,21 +20,42 @@ RSpec.describe ProjectsController do ...@@ -20,21 +20,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