Commit cb3a898f authored by Dallas Reedy's avatar Dallas Reedy

Send new users to Learn GitLab issues board

An experiment where we'll send new users to the Learn GitLab onboarding
issues board once they are done registering.
parent ac0af237
...@@ -14,7 +14,13 @@ module Registrations ...@@ -14,7 +14,13 @@ module Registrations
if current_user.save if current_user.save
hide_advanced_issues hide_advanced_issues
record_experiment_user(:default_to_issues_board)
if experiment_enabled?(:default_to_issues_board) && learn_gitlab.available?
redirect_to namespace_project_board_path(params[:namespace_path], learn_gitlab.project, learn_gitlab.board)
else
redirect_to group_path(params[:namespace_path]) redirect_to group_path(params[:namespace_path])
end
else else
render :show render :show
end end
......
...@@ -68,6 +68,9 @@ module Gitlab ...@@ -68,6 +68,9 @@ module Gitlab
}, },
group_only_trials: { group_only_trials: {
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials' tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials'
},
default_to_issues_board: {
tracking_category: 'Growth::Conversion::Experiment::DefaultToIssuesBoard'
} }
}.freeze }.freeze
......
...@@ -85,16 +85,49 @@ RSpec.describe Registrations::ExperienceLevelsController do ...@@ -85,16 +85,49 @@ RSpec.describe Registrations::ExperienceLevelsController do
end end
end end
context 'when a namespace_path is sent' do describe 'redirection' do
it { is_expected.to have_gitlab_http_status(:redirect) } let(:project) { build(:project, namespace: namespace, creator: user, path: 'project-path') }
it { is_expected.to redirect_to(group_path(namespace)) } let(:issues_board) { build(:board, id: 123, project: project) }
before do
stub_experiment_for_user(
onboarding_issues: true,
default_to_issues_board: default_to_issues_board_xp?
)
allow_next_instance_of(LearnGitlab) do |learn_gitlab|
allow(learn_gitlab).to receive(:available?).and_return(learn_gitlab_available?)
allow(learn_gitlab).to receive(:project).and_return(project)
allow(learn_gitlab).to receive(:board).and_return(issues_board)
end
end end
context 'when no namespace_path is sent' do context 'when namespace_path param is missing' do
let(:params) { super().merge(namespace_path: nil) } let(:params) { super().merge(namespace_path: nil) }
it { is_expected.to have_gitlab_http_status(:redirect) } where(
it { is_expected.to redirect_to(root_path) } default_to_issues_board_xp?: [true, false],
learn_gitlab_available?: [true, false]
)
with_them do
it { is_expected.to redirect_to('/') }
end
end
context 'when we have a namespace_path param' do
using RSpec::Parameterized::TableSyntax
where(:default_to_issues_board_xp?, :learn_gitlab_available?, :path) do
true | true | '/group-path/project-path/-/boards/123'
true | false | '/group-path'
false | true | '/group-path'
false | false | '/group-path'
end
with_them do
it { is_expected.to redirect_to(path) }
end
end
end end
describe 'applying the chosen level' do describe 'applying the chosen level' do
......
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