Skip to content

Migrate pajamas button in subscribable banner helper

Dheeraj Joshi requested to merge djadmin-pajamas-migration-2 into master

What does this MR do and why?

Resolves #417858 (closed)

This migrates the link_to button to link_button_to helper.

Screenshots or screen recordings

No visual changes

Screenshot_2023-09-05_at_9.53.59_AM

How to reproduce

This is a just a hacky way to reproduce this particular HAML / Ruby change

diff --git a/ee/app/helpers/ee/subscribable_banner_helper.rb b/ee/app/helpers/ee/subscribable_banner_helper.rb
index 6fafc42de539..f41d5acd3d64 100644
--- a/ee/app/helpers/ee/subscribable_banner_helper.rb
+++ b/ee/app/helpers/ee/subscribable_banner_helper.rb
@@ -12,7 +12,7 @@ def gitlab_subscription_or_license
     end
 
     def gitlab_subscription_message_or_license_message
-      return subscription_message if display_subscription_banner?
+      return subscription_message
 
       license_message if display_license_banner?
     end
@@ -72,7 +72,7 @@ def subscription_message
       ::Gitlab::ExpiringSubscriptionMessage.new(
         subscribable: decorated_subscription,
         signed_in: signed_in?,
-        is_admin: can?(current_user, :owner_access, entity.root_ancestor),
+        is_admin: true,
         namespace: current_namespace
       ).message
     end
@@ -83,7 +83,7 @@ def subscription_subject
       ::Gitlab::ExpiringSubscriptionMessage.new(
         subscribable: decorated_subscription,
         signed_in: signed_in?,
-        is_admin: can?(current_user, :owner_access, entity.root_ancestor),
+        is_admin: true,
         namespace: current_namespace
       ).subject
     end
@@ -104,7 +104,7 @@ def display_license_banner?
     end
 
     def display_subscription_banner?
-      @display_subscription_banner && ::Gitlab::CurrentSettings.should_check_namespace_plan?
+      true
     end
   end
 end
diff --git a/ee/app/views/layouts/header/_ee_subscribable_banner.html.haml b/ee/app/views/layouts/header/_ee_subscribable_banner.html.haml
index cf47067ed32c..e199b428492f 100644
--- a/ee/app/views/layouts/header/_ee_subscribable_banner.html.haml
+++ b/ee/app/views/layouts/header/_ee_subscribable_banner.html.haml
@@ -2,19 +2,5 @@
 - message = gitlab_subscription_message_or_license_message
 - subject = gitlab_subscription_subject_or_license_subject
 
-- if message.present? && subscribable.present?
-  .js-gitlab-ee-license-banner.hidden{ class: [container_class, @content_class, 'gl-pt-5!'] }
-    = render Pajamas::AlertComponent.new(variant: :danger,
-      title: subject,
-      alert_options: { data: { license_expiry: subscribable.expires_at, defer_links: "true", testid: 'subscribable_banner' }}) do |c|
-      - c.with_body do
-        = message
-      - c.with_actions do
-        - if subscribable.block_changes?
-          = link_to_button_style(path: renew_subscription_path, track_property: 'renew')
-        - elsif subscribable.expired?
-          = link_to_button_style(path: upgrade_subscription_path, track_property: 'upgrade')
-        - else
-          = link_to_button_style(path: renew_subscription_path, track_property: 'renew')
-          = render Pajamas::ButtonComponent.new(category: :secondary, button_options: { class: 'js-close gl-mb-2', 'aria-label': _('Dismiss'), data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: 'thats_ok' } }) do
-            = _("That's OK, I don't want to renew")
+- if true
+  = link_to_button_style(path: renew_subscription_path, track_property: 'renew')
\ No newline at end of file

MR acceptance checklist

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

Edited by Dheeraj Joshi

Merge request reports