Update when storage banner can be dismissed
What does this MR do and why?
It updates when the storage banner can be dismissed, it will be dismissible if the current namespace storage is under the storage limit or the available storage is greater than used storage (in case there is a purchased storage).
Screenshots or screen recordings
below limit (dismissible) | over limit (not dismissible) |
---|---|
How to set up and validate locally
Note: please don't dismiss the banner until after testing, if you really want to dismiss it.
To display the storage banner and mimic storage limit below limit, apply the following patch (e.g. 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?
To display the storage banner and mimic over storage limit, apply the following patch (e.g. pbpaste | git apply -
):
diff --git a/ee/app/models/ee/namespace.rb b/ee/app/models/ee/namespace.rb
index 31791117219a..776c1520e27b 100644
--- a/ee/app/models/ee/namespace.rb
+++ b/ee/app/models/ee/namespace.rb
@@ -211,6 +211,7 @@ def plan_name_for_upgrading
end
def over_storage_limit?
+ return true
::Namespaces::Storage::RootSize.new(root_ancestor).above_size_limit?
end
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?
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #371743
Edited by Ammar Alakkad