Commit 1d21bef5 authored by Jeremy Jackson's avatar Jeremy Jackson Committed by Doug Stull

Allow bypassing registration when joining project

SAAS only: this removes the control experience from the experiment and
implements the feature as defined in the candidate definition.

Changelog: added
EE: true
parent f3c54c92
---
name: bypass_registration
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72827
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/340560
milestone: '14.5'
type: experiment
group: group::adoption
default_enabled: false
......@@ -48,6 +48,11 @@ module EE
private
def show_company_form?
update_params[:setup_for_company] == 'true' &&
::Feature.enabled?(:about_your_company_registration_flow)
end
override :update_params
def update_params
clean_params = super.merge(params.require(:user).permit(:email_opted_in, :registration_objective))
......@@ -74,11 +79,6 @@ module EE
helpers.signup_onboarding_enabled?
end
def show_company_form?
update_params[:setup_for_company] == 'true' &&
::Feature.enabled?(:about_your_company_registration_flow)
end
def authorized_for_trial_onboarding!
access_denied! unless can?(current_user, :owner_access, learn_gitlab_project)
end
......@@ -100,11 +100,8 @@ module EE
override :update_success_path
def update_success_path
if params[:joining_project] == 'true'
bypass_registration_event(:joining_project)
path_for_signed_in_user(current_user)
else
bypass_registration_event(:creating_project)
if show_company_form?
new_users_sign_up_company_path
else
......@@ -112,10 +109,6 @@ module EE
end
end
end
def bypass_registration_event(event_name)
experiment(:bypass_registration, user: current_user).track(event_name, user: current_user)
end
end
end
end
......@@ -56,19 +56,7 @@ module EE
end
def registration_objective_options
options = localized_jobs_to_be_done_choices.dup
experiment(:bypass_registration, user: current_user) do |e|
e.control do
options.merge(
joining_team: _('I’m joining my team who’s already on GitLab')
)
end
e.candidate do
options
end
e.run
end
localized_jobs_to_be_done_choices.dup
end
end
end
- return unless Gitlab.com?
- return if in_trial_flow?
- experiment(:bypass_registration, user: current_user) do |e|
- e.try do
.row
.form-group.col-sm-12
= label_tag :joining_project, _('What would you like to do?'), class: 'label-bold'
.form-check.gl-mb-2
= radio_button_tag :joining_project, false, false, required: true, class: 'form-check-input'
= label_tag :joining_project_false, class: 'form-check-label normal' do
= _('Create a new project')
.form-text.gl-text-gray-600
= _('House your files, plan your work, collaborate on code, and more.')
.form-check
= radio_button_tag :joining_project, true, false, required: true, class: 'form-check-input'
= label_tag :joining_project_true, class: 'form-check-label normal' do
= _('Join a project')
.form-text.gl-text-gray-600
= _('Join your team on GitLab and contribute to an existing project')
- e.publish_to_database
.row
.form-group.col-sm-12
= label_tag :joining_project, _('What would you like to do?'), class: 'label-bold'
.form-check.gl-mb-2
= radio_button_tag :joining_project, false, false, required: true, class: 'form-check-input'
= label_tag :joining_project_false, class: 'form-check-label normal' do
= _('Create a new project')
.form-text.gl-text-gray-600
= _('House your files, plan your work, collaborate on code, and more.')
.form-check
= radio_button_tag :joining_project, true, false, required: true, class: 'form-check-input'
= label_tag :joining_project_true, class: 'form-check-label normal' do
= _('Join a project')
.form-text.gl-text-gray-600
= _('Join your team on GitLab and contribute to an existing project')
......@@ -263,20 +263,6 @@ RSpec.describe Registrations::WelcomeController do
let(:joining_project) { 'true' }
it { is_expected.to redirect_to dashboard_projects_path }
it 'creates a "joining_project" experiment track event' do
expect(experiment(:bypass_registration)).to track(:joining_project, user: user).on_next_instance
subject
end
end
context 'when joining_project is "false"', :experiment do
it 'creates a "creating_project" experiment track event' do
expect(experiment(:bypass_registration)).to track(:creating_project, user: user).on_next_instance
subject
end
end
context 'when joining_project is "false"' do
......
......@@ -18,6 +18,7 @@ RSpec.describe 'Combined registration flow', :js do
expect(page).to have_content('Welcome to GitLab')
choose 'My company or team'
choose 'Create a new project'
click_on 'Continue'
end
......
......@@ -16,6 +16,7 @@ RSpec.describe 'User sees new onboarding flow', :js do
expect(page).to have_content('Welcome to GitLab')
choose 'My company or team'
choose 'Create a new project'
click_on 'Continue'
expect(page).to have_content('GitLab Ultimate trial (optional)')
......
......@@ -16,6 +16,7 @@ RSpec.describe 'User sees new onboarding flow', :js do
expect(page).to have_content('Welcome to GitLab')
choose 'Just me'
choose 'Create a new project'
click_on 'Continue'
expect(page).to have_content('Create your group')
......
......@@ -30,6 +30,7 @@ RSpec.describe 'Welcome screen', :js do
page.select('Software Developer', from: 'user_role')
choose 'user_setup_for_company_true'
choose 'Create a new project'
click_button 'Continue'
......@@ -54,6 +55,7 @@ RSpec.describe 'Welcome screen', :js do
page.select('Software Developer', from: 'user_role')
choose 'user_setup_for_company_true'
choose 'Create a new project'
expect(page).not_to have_selector('input[name="user[email_opted_in]', visible: true)
......@@ -67,6 +69,7 @@ RSpec.describe 'Welcome screen', :js do
page.select('Software Developer', from: 'user_role')
choose 'user_setup_for_company_false'
choose 'Create a new project'
expect(page).to have_selector('input[name="user[email_opted_in]', visible: true)
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe EE::RegistrationsHelper do
include Devise::Test::ControllerHelpers
let(:expected_keys) { UserDetail.registration_objectives.keys - ['joining_team'] }
describe '#shuffled_registration_objective_options' do
subject(:shuffled_options) { helper.shuffled_registration_objective_options }
......@@ -11,23 +12,12 @@ RSpec.describe EE::RegistrationsHelper do
it 'has values that match all UserDetail registration objective keys' do
shuffled_option_values = shuffled_options.map { |item| item.last }
expect(shuffled_option_values).to contain_exactly(*UserDetail.registration_objectives.keys)
expect(shuffled_option_values).to contain_exactly(*expected_keys)
end
it '"other" is always the last option' do
expect(shuffled_options.last).to eq(['A different reason', 'other'])
end
context 'when the bypass_registration experiment is candidate', :experiment do
before do
stub_experiments({ bypass_registration: :candidate })
end
it "excludes the joining_team option" do
shuffled_option_values = shuffled_options.map { |item| item.last }
expect(shuffled_option_values).to contain_exactly(*UserDetail.registration_objectives.keys.reject {|k| k == "joining_team"})
end
end
end
describe '#registration_verification_enabled?' do
......
......@@ -53,16 +53,7 @@ RSpec.describe 'registrations/welcome/show' do
end
it { is_expected_to_have_progress_bar(status: show_progress_bar) }
context 'bypass_registration experiment' do
it { is_expected.not_to have_selector('#joining_project_true') }
context 'when in the candidate variant' do
let(:experiments) { { bypass_registration: :candidate } }
it { is_expected_to_show_joining_question(show_joining_question) }
end
end
it { is_expected_to_show_joining_question(show_joining_question) }
context 'feature flag other_role_details is enabled' do
let_it_be(:user_other_role_details_enabled) { true }
......
......@@ -21292,9 +21292,6 @@ msgstr ""
msgid "Iteration|cannot be more than 500 years in the future"
msgstr ""
msgid "I’m joining my team who’s already on GitLab"
msgstr ""
msgid "Jaeger URL"
msgstr ""
......
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