diff options
Diffstat (limited to 'app/controllers/registrations_controller.rb')
-rw-r--r-- | app/controllers/registrations_controller.rb | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 2a865aac767..a1252c68403 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -26,18 +26,18 @@ class RegistrationsController < Devise::RegistrationsController end def create - track_experiment_event(:terms_opt_in, 'end') accept_pending_invitations super do |new_user| persist_accepted_terms_if_required(new_user) set_role_required(new_user) + track_terms_experiment(new_user) yield new_user if block_given? end - # Do not show the signed_up notice message when the signup_flow experiment is enabled. - # Instead, show it after successfully updating the role. - flash[:notice] = nil if experiment_enabled?(:signup_flow) + # Devise sets a flash message on `create` for a successful signup, + # which we don't want to show. + flash[:notice] = nil rescue Gitlab::Access::AccessDeniedError redirect_to(new_user_session_path) end @@ -69,7 +69,6 @@ class RegistrationsController < Devise::RegistrationsController return redirect_to new_users_sign_up_group_path if experiment_enabled?(:onboarding_issues) && show_onboarding_issues_experiment? - set_flash_message! :notice, :signed_up redirect_to path_for_signed_in_user(current_user) else render :welcome @@ -89,7 +88,7 @@ class RegistrationsController < Devise::RegistrationsController end def set_role_required(new_user) - new_user.set_role_required! if new_user.persisted? && experiment_enabled?(:signup_flow) + new_user.set_role_required! if new_user.persisted? end def destroy_confirmation_valid? @@ -115,9 +114,7 @@ class RegistrationsController < Devise::RegistrationsController def after_sign_up_path_for(user) Gitlab::AppLogger.info(user_created_message(confirmed: user.confirmed?)) - return users_sign_up_welcome_path if experiment_enabled?(:signup_flow) - - path_for_signed_in_user(user) + users_sign_up_welcome_path end def after_inactive_sign_up_path_for(resource) @@ -154,7 +151,7 @@ class RegistrationsController < Devise::RegistrationsController end def sign_up_params - params.require(:user).permit(:username, :email, :email_confirmation, :name, :first_name, :last_name, :password) + params.require(:user).permit(:username, :email, :name, :first_name, :last_name, :password) end def resource_name @@ -201,6 +198,13 @@ class RegistrationsController < Devise::RegistrationsController true end + def track_terms_experiment(new_user) + return unless new_user.persisted? + + track_experiment_event(:terms_opt_in, 'end') + record_experiment_user(:terms_opt_in) + end + def load_recaptcha Gitlab::Recaptcha.load_configurations! end @@ -208,7 +212,7 @@ class RegistrationsController < Devise::RegistrationsController # Part of an experiment to build a new sign up flow. Will be resolved # with https://gitlab.com/gitlab-org/growth/engineering/issues/64 def choose_layout - if experiment_enabled?(:signup_flow) + if %w(welcome update_registration).include?(action_name) || experiment_enabled?(:signup_flow) 'devise_experimental_separate_sign_up_flow' else 'devise' @@ -216,7 +220,10 @@ class RegistrationsController < Devise::RegistrationsController end def show_onboarding_issues_experiment? - !helpers.in_subscription_flow? && !helpers.in_invitation_flow? && !helpers.in_oauth_flow? + !helpers.in_subscription_flow? && + !helpers.in_invitation_flow? && + !helpers.in_oauth_flow? && + !helpers.in_trial_flow? end end |