Skip to content

Improve trial only CTAs in Learn GitLab

Hinam Mehra requested to merge 354334-fix-trial-only-ctas-in-learn-gitlab into master

What does this MR do and why?

  1. Redirects only admins of namespace to the Start your Free Ultimate Trial page.
  2. Once an admin has started a trial, they get taken to the relevant GitLab Docs for Add code owners & Add merge request approval.
  3. If a user doesn't have permission to start a trial in that namespace, they get taken to the relevant GitLab Docs for Add code owners & Add merge request approval every time.

Screenshots or screen recordings

CTAs as an admin of the namespace:

CTA-as-an-admin

CTAs as a non-admin of the namespace:

CTA-as-a-non-admin

How to set up and validate locally

To test CTAs as an admin

  1. Simulate SaaS by exporting an environment variable: $ export GITLAB_SIMULATE_SAAS=1
  2. Restart Rails
  3. Navigate to a Learn GitLab project (if you don't already have one, you can sign-up as a new user http://localhost:3000/users/sign_up which will set-up it up for you during the onboarding process).
  4. Click on Start a free Ultimate trial or Add code owners or Add merge request approval links. All of these should take you to the trial page.
  5. Then, manually enable an Ultimate Trial for this namespace:
$ bundle exec rails c

>> namespace_id = Namespace.find_by(path: {your-namespace-path})

>> Namespace.find(namespace_id).gitlab_subscription.update(
trial: true, trial_starts_on: Date.today, trial_ends_on: 15.days.from_now, 
hosted_plan_id: 6)

>> OnboardingProgress.find_by(namespace_id: namespace_id).update(trial_started_at: Date.today)
  1. Refresh the page, now the Start a free Ultimate trial link should have a green-tick next to it, and the Add code owners & Add merge request approval links should take you to the relevant GitLab docs.

To test CTAs as a non-admin

  1. Following from the previous step, as an admin of the Learn GitLab project, invite another user as a Guest on this namespace from http://localhost:3000/{your-namespace-id}/learn-gitlab/-/project_members
  2. Log-in as the guest user and navigate to the Learn GitLab project
  3. The Start a free Ultimate trial shouldn't be rendered as a link, and should have a popover asking you to contact the admin to start a trial.
  4. The Add code owners & Add merge request approval links should take you to the relevant GitLab docs.

MR acceptance checklist

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

Related to #354334

Edited by Hinam Mehra

Merge request reports