Skip to content

Show storage banner if namespace is over limit

What does this MR do and why?

It updates the render? method to show the pre-enforcement banner to users (who has dismissed it) if the namespace is over storage limit.

Note: the change is behind disabled feature flags, that's why I didn't add a changelog or updated the docs.

Screenshots or screen recordings

before after
N/A Screenshot_2023-01-17_at_11.37.03

How to set up and validate locally

Apply this patch to show the pre enforcement banners

(You can apply it by copying it then in terminal run pbpaste | git apply -)

diff --git a/ee/lib/ee/gitlab/namespaces/storage/enforcement.rb b/ee/lib/ee/gitlab/namespaces/storage/enforcement.rb
index 19f54fffea33..7bac5dd1737a 100644
--- a/ee/lib/ee/gitlab/namespaces/storage/enforcement.rb
+++ b/ee/lib/ee/gitlab/namespaces/storage/enforcement.rb
@@ -20,6 +20,7 @@ def self.enforce_limit?(namespace)
           end
 
           def self.show_pre_enforcement_banner?(namespace)
+            return true
             root_namespace = namespace.root_ancestor
 
             return false unless ::Gitlab::CurrentSettings.should_check_namespace_plan?
  1. Create a new group
  2. Navigate to the group's usage quotas page
  3. While on master branch
  4. Dismiss the pre-enforcement banner
  5. Refresh the page and observe the banner doesn't show
  6. Apply the following patch to make namespaces over size limit
    diff --git a/ee/app/models/ee/namespace.rb b/ee/app/models/ee/namespace.rb
    index 9e8254d55473..4ba960ac19cc 100644
    --- a/ee/app/models/ee/namespace.rb
    +++ b/ee/app/models/ee/namespace.rb
    @@ -213,6 +213,7 @@ def plan_name_for_upgrading
         end
    
         def over_storage_limit?
    +      return true
           ::Namespaces::Storage::RootSize.new(root_ancestor).above_size_limit?
         end
  7. Switch to branch 371743-show-pre-enforcement-banner-when-over-limit
  8. Refresh the page and confirm the banner is shown

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #371743

Edited by Ammar Alakkad

Merge request reports

Loading