Commit 13dbd89a authored by Doug Stull's avatar Doug Stull

Merge branch 'jswain_redirect_source_urls_for_trial' into 'master'

Enable trial onboarding flow for other sources

See merge request gitlab-org/gitlab!77992
parents 632ce7c6 d95bb413
......@@ -35,7 +35,7 @@ class TrialsController < ApplicationController
render(:new) && return unless @result[:success]
if params[:glm_source] == 'about.gitlab.com'
if EE::TrialHelper::TRIAL_ONBOARDING_SOURCE_URLS.include?(params[:glm_source])
redirect_to(new_users_sign_up_group_path(url_params.merge(trial_onboarding_flow: true)))
elsif @namespace = helpers.only_trialable_group_namespace
params[:namespace_id] = @namespace.id
......
......@@ -2,6 +2,8 @@
module EE
module TrialHelper
TRIAL_ONBOARDING_SOURCE_URLS = %w(about.gitlab.com docs.gitlab.com learn.gitlab.com).freeze
def company_size_options_for_select(selected = '')
options_for_select([
[_('Please select'), ''],
......@@ -23,7 +25,7 @@ module EE
end
def should_ask_company_question?
glm_params[:glm_source] != 'about.gitlab.com'
TRIAL_ONBOARDING_SOURCE_URLS.exclude?(glm_params[:glm_source])
end
def glm_params
......
......@@ -102,6 +102,22 @@ RSpec.describe TrialsController, :saas do
end
end
context 'coming from docs.gitlab.com' do
let(:post_params) { { glm_source: 'docs.gitlab.com' } }
it 'redirects to trial onboarding' do
is_expected.to redirect_to(new_users_sign_up_group_path(glm_source: 'docs.gitlab.com', trial_onboarding_flow: true))
end
end
context 'coming from learn.gitlab.com' do
let(:post_params) { { glm_source: 'learn.gitlab.com' } }
it 'redirects to trial onboarding' do
is_expected.to redirect_to(new_users_sign_up_group_path(glm_source: 'learn.gitlab.com', trial_onboarding_flow: true))
end
end
context 'when user has 1 trial eligible namespace', :experiment do
let_it_be(:namespace) { create(:group, path: 'namespace-test') }
......
......@@ -64,6 +64,8 @@ RSpec.describe EE::TrialHelper do
where(:glm_source, :result) do
'about.gitlab.com' | false
'learn.gitlab.com' | false
'docs.gitlab.com' | false
'abouts.gitlab.com' | true
'about.gitlab.org' | true
'about.gitlob.com' | true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment