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 ...@@ -35,7 +35,7 @@ class TrialsController < ApplicationController
render(:new) && return unless @result[:success] 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))) redirect_to(new_users_sign_up_group_path(url_params.merge(trial_onboarding_flow: true)))
elsif @namespace = helpers.only_trialable_group_namespace elsif @namespace = helpers.only_trialable_group_namespace
params[:namespace_id] = @namespace.id params[:namespace_id] = @namespace.id
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
module EE module EE
module TrialHelper module TrialHelper
TRIAL_ONBOARDING_SOURCE_URLS = %w(about.gitlab.com docs.gitlab.com learn.gitlab.com).freeze
def company_size_options_for_select(selected = '') def company_size_options_for_select(selected = '')
options_for_select([ options_for_select([
[_('Please select'), ''], [_('Please select'), ''],
...@@ -23,7 +25,7 @@ module EE ...@@ -23,7 +25,7 @@ module EE
end end
def should_ask_company_question? def should_ask_company_question?
glm_params[:glm_source] != 'about.gitlab.com' TRIAL_ONBOARDING_SOURCE_URLS.exclude?(glm_params[:glm_source])
end end
def glm_params def glm_params
......
...@@ -102,6 +102,22 @@ RSpec.describe TrialsController, :saas do ...@@ -102,6 +102,22 @@ RSpec.describe TrialsController, :saas do
end end
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 context 'when user has 1 trial eligible namespace', :experiment do
let_it_be(:namespace) { create(:group, path: 'namespace-test') } let_it_be(:namespace) { create(:group, path: 'namespace-test') }
......
...@@ -64,6 +64,8 @@ RSpec.describe EE::TrialHelper do ...@@ -64,6 +64,8 @@ RSpec.describe EE::TrialHelper do
where(:glm_source, :result) do where(:glm_source, :result) do
'about.gitlab.com' | false 'about.gitlab.com' | false
'learn.gitlab.com' | false
'docs.gitlab.com' | false
'abouts.gitlab.com' | true 'abouts.gitlab.com' | true
'about.gitlab.org' | true 'about.gitlab.org' | true
'about.gitlob.com' | 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