Skip to content

Fix close button for subscription expired alert

What does this MR do and why?

Trigger alert dismissal on child elements for close button. This is a desired behavior.

Before click on child elements was not setting a correct cookie.

Related: #334070 (closed)

Screenshots or screen recordings

Before After
Screen_Recording_2021-10-12_at_15.14.18 Screen_Recording_2021-10-12_at_15.44.04

How to set up and validate locally

  1. Choose an existing group with Premium/Ultimate subscription OR create a new one

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/presenters/subscription_presenter.rb b/ee/app/presenters/subscription_presenter.rb
index aa42356c72d..755ca0d1665 100644
--- a/ee/app/presenters/subscription_presenter.rb
+++ b/ee/app/presenters/subscription_presenter.rb
@@ -22,7 +22,7 @@ def notify_users?
   end
 
   def expires_at
-    end_date
+    Date.today
   end
 
   def block_changes_at
diff --git a/ee/lib/gitlab/expiring_subscription_message.rb b/ee/lib/gitlab/expiring_subscription_message.rb
index b8e7d6f244d..cb701003b54 100644
--- a/ee/lib/gitlab/expiring_subscription_message.rb
+++ b/ee/lib/gitlab/expiring_subscription_message.rb
@@ -9,7 +9,10 @@ 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
+      return false
+    end
 
     def initialize(subscribable:, signed_in:, is_admin:, namespace: nil, force_notification: false)
       @subscribable = subscribable
@@ -20,7 +23,7 @@ def initialize(subscribable:, signed_in:, is_admin:, namespace: nil, force_notif
     end
 
     def message
-      return unless notifiable?
+      # return unless notifiable?
 
       message = []
       message << license_message_subject if license_message_subject.present?
  1. Open the group page http://localhost:3000/groups/name-of-the-group and check the notification message

MR acceptance checklist

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

Merge request reports