Skip to content

Only include the duo pro widget data if ultimate trial is absent

Doug Stull requested to merge 457265-fix-widget-props into master

What does this MR do and why?

Only include the duo pro widget data if ultimate trial is absent

  • Since currently the data attributes are flattened and provided to app/assets/javascripts/super_sidebar/super_sidebar_bundle.js using the same named attributes, we can only provide one of these. These will only collide when there is an ultimate trial with a duo pro trial. For now we've decided to only show the ultimate trial widget until we create a combined one so this change is ok. Longer-term, in a follow-up, we should group these attributes for each in a unique object in javascript side so that they can both be provided to the view layer and it can figure out which to show and what to do with that data.
  • See #461954 (closed)

Changelog: fixed EE: true

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
Screenshot_2024-05-15_at_11.17.44_PM Screenshot_2024-05-15_at_11.16.42_PM

How to set up and validate locally

  1. Setup GDK to simulate SaaS
  2. Create a new top-level group.
  3. Go to admin panel and edit the group to apply the Ultimate plan.
  4. Add a duo pro trial to that namespace in the rails console
n = Namespace.last
add_on = ::GitlabSubscriptions::AddOn.where(name: ::GitlabSubscriptions::AddOn.names[:code_suggestions]).last
::GitlabSubscriptions::AddOnPurchase.create(add_on: add_on, namespace: n, quantity: 1, expires_on: 30.days.from_now, purchase_xid: SecureRandom.hex(16), trial: true)
  1. Visit the group page and verify widget seen.
  2. Now go back to the admin panel and edit that group to be on the Ultimate trial plan.
  3. In rails console, change the trial, trial start and end date for the group
    Group.last.gitlab_subscription.update_columns(trial_starts_on: Date.today, trial_ends_on: 30.days.from_now, trial: true)
  4. Visit the group page and verify ONLY the ultimate trial widget is seen and popover works when hovering.

Related to #457265

Edited by Doug Stull

Merge request reports