Skip to content

Change wording for expired message

Diana Zubova requested to merge dz/330988-expiration-banner into master

What does this MR do?

Update a message that is shown to SaaS users from 15 to 30 days after expiration

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/330988

Screenshots or Screencasts (strongly suggested)

Before After
Screenshot_2021-09-09_at_13.05.06 Screenshot_2021-09-10_at_10.38.42

How to setup and validate locally (strongly suggested)

  1. Create a new group
  2. 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?
1. Open the group page http://localhost:3000/groups// and check the notification message

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Diana Zubova

Merge request reports