Commit 844f2a0d authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '280862-clarify-namespacestoragelimitalerthelper-method-name' into 'master'

Rename NamespaceStorageLimitAlertHelper method

See merge request gitlab-org/gitlab!47574
parents 89dabdb3 01dd1b76
...@@ -46,7 +46,7 @@ module EE ...@@ -46,7 +46,7 @@ module EE
end end
end end
def can_purchase_storage_for_namespace?(namespace) def purchase_storage_link_enabled?(namespace)
::Feature.enabled?(:buy_storage_link) && ::Feature.enabled?(:buy_storage_link) &&
namespace.additional_repo_storage_by_namespace_enabled? namespace.additional_repo_storage_by_namespace_enabled?
end end
...@@ -59,11 +59,6 @@ module EE ...@@ -59,11 +59,6 @@ module EE
end end
end end
def can_purchase_storage?
::Gitlab::CurrentSettings.enforce_namespace_storage_limit? &&
::Feature.enabled?(:buy_storage_link)
end
def purchase_storage_url def purchase_storage_url
EE::SUBSCRIPTIONS_MORE_STORAGE_URL EE::SUBSCRIPTIONS_MORE_STORAGE_URL
end end
......
- page_title s_("UsageQuota|Usage") - page_title s_("UsageQuota|Usage")
- url_to_purchase_storage = purchase_storage_url if can_purchase_storage_for_namespace?(@group) - url_to_purchase_storage = purchase_storage_url if purchase_storage_link_enabled?(@group)
%h3.page-title %h3.page-title
= s_('UsageQuota|Usage Quotas') = s_('UsageQuota|Usage Quotas')
...@@ -22,4 +22,3 @@ ...@@ -22,4 +22,3 @@
locals: { namespace: @group, projects: @projects } locals: { namespace: @group, projects: @projects }
.tab-pane#storage-quota-tab .tab-pane#storage-quota-tab
#js-storage-counter-app{ data: { namespace_path: @group.full_path, help_page_path: help_page_path('user/group/index.md', anchor: 'storage-usage-quota'), purchase_storage_url: url_to_purchase_storage, is_temporary_storage_increase_visible: temporary_storage_increase_visible?(@group).to_s } } #js-storage-counter-app{ data: { namespace_path: @group.full_path, help_page_path: help_page_path('user/group/index.md', anchor: 'storage-usage-quota'), purchase_storage_url: url_to_purchase_storage, is_temporary_storage_increase_visible: temporary_storage_increase_visible?(@group).to_s } }
- page_title s_("UsageQuota|Usage") - page_title s_("UsageQuota|Usage")
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
- url_to_purchase_storage = purchase_storage_url if can_purchase_storage_for_namespace?(@namespace) - url_to_purchase_storage = purchase_storage_url if purchase_storage_link_enabled?(@namespace)
%h3.page-title %h3.page-title
= s_('UsageQuota|Usage Quotas') = s_('UsageQuota|Usage Quotas')
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
- style = namespace_storage_alert_style(alert_level) - style = namespace_storage_alert_style(alert_level)
- icon = namespace_storage_alert_icon(alert_level) - icon = namespace_storage_alert_icon(alert_level)
- purchase_link = purchase_storage_url if can_purchase_storage_for_namespace?(namespace) - purchase_link = purchase_storage_url if purchase_storage_link_enabled?(namespace)
- usage_link = namespace_storage_usage_link(root_namespace) - usage_link = namespace_storage_usage_link(root_namespace)
- show_storage_banner_actions = purchase_link || usage_link - show_storage_banner_actions = purchase_link || usage_link
......
...@@ -72,26 +72,6 @@ RSpec.describe EE::NamespaceStorageLimitAlertHelper do ...@@ -72,26 +72,6 @@ RSpec.describe EE::NamespaceStorageLimitAlertHelper do
end end
end end
describe '#can_purchase_storage?' do
subject { helper.can_purchase_storage? }
where(:enforcement_setting_enabled, :feature_enabled, :result) do
false | false | false
false | true | false
true | false | false
true | true | true
end
with_them do
before do
stub_application_setting(enforce_namespace_storage_limit: enforcement_setting_enabled)
stub_feature_flags(buy_storage_link: feature_enabled)
end
it { is_expected.to eq(result) }
end
end
describe '#purchase_storage_url' do describe '#purchase_storage_url' do
subject { helper.purchase_storage_url } subject { helper.purchase_storage_url }
...@@ -196,8 +176,8 @@ RSpec.describe EE::NamespaceStorageLimitAlertHelper do ...@@ -196,8 +176,8 @@ RSpec.describe EE::NamespaceStorageLimitAlertHelper do
end end
end end
describe '#can_purchase_storage_for_namespace?' do describe '#purchase_storage_link_enabled?' do
subject { helper.can_purchase_storage_for_namespace?(namespace) } subject { helper.purchase_storage_link_enabled?(namespace) }
let_it_be(:namespace) { build(:namespace) } let_it_be(:namespace) { build(: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