Commit 9e62f214 authored by Kerri Miller's avatar Kerri Miller

Merge branch...

Merge branch '350286-experiment-cleanup-redirect-in-app-trial-users-to-the-feature-that-they-requested-the-trial' into 'master'

Redirect in-app trial users to the feature

See merge request gitlab-org/gitlab!78917
parents d0eeb283 4b5c46c6
---
name: redirect_trial_user_to_feature
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65450
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335824
milestone: '14.1'
type: experiment
group: group::conversion
default_enabled: false
......@@ -214,14 +214,6 @@ class TrialsController < ApplicationController
group
end
def redirect_trial_user_to_feature_experiment_flow
experiment(:redirect_trial_user_to_feature, namespace: @namespace) do |e|
e.use { redirect_to group_url(@namespace, { trial: true }) }
e.try { redirect_to group_security_dashboard_url(@namespace, { trial: true }) }
e.publish_to_database
end
end
def discover_group_security_flow?
%w(discover-group-security discover-project-security).include?(params[:glm_content])
end
......@@ -238,7 +230,7 @@ class TrialsController < ApplicationController
experiment(:combined_registration, user: current_user).track(:create_trial)
if discover_group_security_flow?
redirect_trial_user_to_feature_experiment_flow
redirect_to group_security_dashboard_url(@namespace, { trial: true })
else
redirect_to stored_location_or_provided_path(group_url(@namespace, { trial: true }))
end
......
......@@ -411,30 +411,16 @@ RSpec.describe TrialsController, :saas do
context 'redirect trial user to feature' do
using RSpec::Parameterized::TableSyntax
where(:segment, :glm_content, :redirect) do
:control | 'discover-group-security' | :group_url
:candidate | 'discover-group-security' | :group_security_dashboard_url
:control | 'discover-project-security' | :group_url
:candidate | 'discover-project-security' | :group_security_dashboard_url
where(:glm_content, :redirect) do
'discover-group-security' | :group_security_dashboard_url
'discover-project-security' | :group_security_dashboard_url
end
with_them do
let(:post_params) { { namespace_id: namespace.id, glm_content: glm_content } }
let(:variant) { segment == :control ? :control : :experimental }
let(:redirect_url) do
redirect == :group_url ? group_url(namespace, { trial: true }) : group_security_dashboard_url(namespace, { trial: true })
end
before do
stub_experiments(redirect_trial_user_to_feature: segment)
end
let(:redirect_url) { group_security_dashboard_url(namespace, { trial: true }) }
it { is_expected.to redirect_to(redirect_url) }
it 'records the subject' do
expect(Experiment).to receive(:add_subject).with('redirect_trial_user_to_feature', variant: variant, subject: namespace)
post_apply
end
end
end
......
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