Improve trial only CTAs in Learn GitLab
What does this MR do and why?
- Redirects only admins of namespace to the
Start your Free Ultimate Trial
page. - Once an admin has started a trial, they get taken to the relevant GitLab Docs for
Add code owners
&Add merge request approval
. - 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:
CTAs as a non-admin of the namespace:
How to set up and validate locally
To test CTAs as an admin
- Simulate SaaS by exporting an environment variable:
$ export GITLAB_SIMULATE_SAAS=1
- Restart Rails
- Navigate to a
Learn GitLab
project (if you don't already have one, you can sign-up as a new userhttp://localhost:3000/users/sign_up
which will set-up it up for you during the onboarding process). - Click on
Start a free Ultimate trial
orAdd code owners
orAdd merge request approval
links. All of these should take you to the trial page. - 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)
- Refresh the page, now the
Start a free Ultimate trial
link should have a green-tick next to it, and theAdd code owners
&Add merge request approval
links should take you to the relevant GitLab docs.
To test CTAs as a non-admin
- Following from the previous step, as an admin of the
Learn GitLab
project, invite another user as aGuest
on this namespace fromhttp://localhost:3000/{your-namespace-id}/learn-gitlab/-/project_members
- Log-in as the guest user and navigate to the
Learn GitLab
project - 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. - 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #354334
Edited by Hinam Mehra