Remove cutoff logic for expiration message
What does this MR do and why?
Clean up for introduced a year ago grace period start. It is now safe to remove it.
Related to https://gitlab.com/gitlab-org/gitlab/-/issues/330988
Screenshots or screen recordings
N/A
How to set up and validate locally
We don't expect changes to expiration notifications
Both SaaS and SelfManaged notification about subscription expiration should appear as expected.
To check visually that everything is working as it should:
SelfManaged
- Apply expired license and check notification
SaaS
- Create a new group
- Add a Premium/Ultimate subscription to it
We would need to emulate the expired subscription for this group. There is a patch you need to apply under the spoiler. I didn't find a better way for it, please let me know if there is one
Patch
diff --git a/ee/app/models/gitlab_subscription.rb b/ee/app/models/gitlab_subscription.rb
index 7d81f3ebbc5..08be5aed565 100644
--- a/ee/app/models/gitlab_subscription.rb
+++ b/ee/app/models/gitlab_subscription.rb
@@ -81,6 +81,7 @@ def has_a_paid_hosted_plan?(include_trials: false)
end
def expired?
+ return true
return false unless end_date
end_date < Date.current
diff --git a/ee/app/presenters/subscription_presenter.rb b/ee/app/presenters/subscription_presenter.rb
index b726876e4aa..08c5ec00f79 100644
--- a/ee/app/presenters/subscription_presenter.rb
+++ b/ee/app/presenters/subscription_presenter.rb
@@ -22,13 +22,15 @@ def notify_users?
end
def expires_at
- end_date
+ # end_date
+ end_date - 385
end
def block_changes_at
return unless end_date
- end_date + GRACE_PERIOD_EXTENSION_DAYS
+ # end_date + GRACE_PERIOD_EXTENSION_DAYS
+ end_date + GRACE_PERIOD_EXTENSION_DAYS - 385
end
def remaining_days
diff --git a/ee/lib/gitlab/expiring_subscription_message.rb b/ee/lib/gitlab/expiring_subscription_message.rb
index 76e57d5c1d6..ac6d5e92f63 100644
--- a/ee/lib/gitlab/expiring_subscription_message.rb
+++ b/ee/lib/gitlab/expiring_subscription_message.rb
@@ -9,7 +9,11 @@ class ExpiringSubscriptionMessage
attr_reader :subscribable, :signed_in, :is_admin, :namespace, :force_notification
- delegate :auto_renew, to: :subscribable
+ # delegate :auto_renew, to: :subscribable
+ def auto_renew
+ # We show a different message if auto_renew is enabled
+ return false
+ end
def initialize(subscribable:, signed_in:, is_admin:, namespace: nil, force_notification: false)
@subscribable = subscribable
@@ -159,7 +163,9 @@ def plan_name
end
def plan_downgraded?
- plan_name.downcase == ::Plan::FREE
+ # plan_name.downcase == ::Plan::FREE
+ # we don't show the post expiration message if the group is not yet downgraded
+ return true
end
def show_downgrade_messaging?
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.
Edited by Diana Zubova