diff --git a/ee/app/components/namespaces/storage/limit_alert_component.rb b/ee/app/components/namespaces/storage/limit_alert_component.rb index 0f60ef3d2ba2b12d784f074dcebc388cde183e9d..f5d8524bec1bf16d6ae921e54bc5f7823ab5b6e0 100644 --- a/ee/app/components/namespaces/storage/limit_alert_component.rb +++ b/ee/app/components/namespaces/storage/limit_alert_component.rb @@ -125,6 +125,10 @@ def user_has_access? end end + def limit + root_storage_size.dashboard_limit + end + def namespace_has_additional_storage_purchased? root_namespace.additional_purchased_storage_size > 0 end @@ -149,7 +153,7 @@ def show_purchase_link? def free_tier_alert_title text_args = { namespace_name: root_namespace.name, - free_size_limit: formatted(root_namespace.actual_size_limit) + free_size_limit: formatted(limit) } s_( @@ -162,7 +166,7 @@ def usage_percentage_alert_title usage_in_percent: used_storage_percentage(root_storage_size.usage_ratio), namespace_name: root_namespace.name, used_storage: formatted(root_storage_size.current_size), - storage_limit: formatted(root_storage_size.limit) + storage_limit: formatted(limit) } s_( diff --git a/ee/app/components/namespaces/storage/repository_limit_alert_component.rb b/ee/app/components/namespaces/storage/repository_limit_alert_component.rb index c85c9bf830717bd0e62e7316318b6fb29c2419a1..f94f738aefb37639eff5f33f5bbca7fe3f84c741 100644 --- a/ee/app/components/namespaces/storage/repository_limit_alert_component.rb +++ b/ee/app/components/namespaces/storage/repository_limit_alert_component.rb @@ -45,7 +45,7 @@ def usage_percentage_alert_title def free_tier_alert_title text_args = { readonly_project_count: root_namespace.repository_size_excess_project_count, - free_size_limit: formatted(root_namespace.actual_size_limit) + free_size_limit: formatted(limit) } ns_( @@ -59,7 +59,7 @@ def free_tier_alert_title def alert_message_explanation text_args = { - free_size_limit: formatted(root_namespace.actual_size_limit) + free_size_limit: formatted(limit) } if root_storage_size.above_size_limit? @@ -114,6 +114,10 @@ def alert_message_cta s_("NamespaceStorageSize|To reduce storage usage, reduce git repository and git LFS storage.") end end + + def limit + root_namespace.actual_size_limit + end end end end diff --git a/ee/spec/components/namespaces/storage/limit_alert_component_spec.rb b/ee/spec/components/namespaces/storage/limit_alert_component_spec.rb index 050e1eed52f12936fcc477eecc3eb01e88033c5e..3295402b4f311476913eb77d43208b9512ca39ae 100644 --- a/ee/spec/components/namespaces/storage/limit_alert_component_spec.rb +++ b/ee/spec/components/namespaces/storage/limit_alert_component_spec.rb @@ -21,7 +21,7 @@ let(:usage_ratio) { 0.8 } let(:above_size_limit) { false } let(:alert_title) { /You have used \d+% of the storage quota for #{group.name}/ } - let(:alert_title_free_tier) { "You have reached the free storage limit of 1,000 MiB for #{group.name}" } + let(:alert_title_free_tier) { "You have reached the free storage limit of 5 GiB for #{group.name}" } let(:alert_message_below_limit) do "If #{group.name} exceeds the storage quota, your ability to write new data to this namespace will be " \ @@ -56,7 +56,7 @@ allow(size_checker).to receive(:above_size_limit?).and_return(above_size_limit) end - allow(group).to receive(:actual_size_limit).and_return(1000.megabytes) + set_dashboard_limit(group, megabytes: 5120) stub_member_access_level(group, owner: user) end @@ -137,6 +137,17 @@ end end end + + context 'and enforcement_limit is higher than dashboard_limit' do + before do + set_enforcement_limit(group, megabytes: 10240) + end + + it 'renders the title with the dashboard_limit' do + render_inline(component) + expect(page).to have_content('5 GiB') + end + end end describe '#render?' do