diff --git a/ee/app/components/namespaces/storage/limit_alert_component.rb b/ee/app/components/namespaces/storage/limit_alert_component.rb index a197adf7ded6cd80e2e4d2732eb8f7c7f76674f7..a5a9f6655f161e9df6282ee353ecfed6242140be 100644 --- a/ee/app/components/namespaces/storage/limit_alert_component.rb +++ b/ee/app/components/namespaces/storage/limit_alert_component.rb @@ -131,6 +131,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 @@ -155,7 +159,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_( @@ -168,7 +172,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 4470cc50f256c1815fec033db376b768702518ec..311de1848b755245355086fe11a55bbacc38b30b 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