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 |
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?
- Create a new group
- Navigate to the group's usage quotas page
- While on
master
branch - Dismiss the pre-enforcement banner
- Refresh the page and observe the banner doesn't show
- 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
- Switch to branch
371743-show-pre-enforcement-banner-when-over-limit
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #371743
Edited by Ammar Alakkad