Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/controllers/registrations
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/controllers/registrations')
-rw-r--r--app/controllers/registrations/experience_levels_controller.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/app/controllers/registrations/experience_levels_controller.rb b/app/controllers/registrations/experience_levels_controller.rb
new file mode 100644
index 00000000000..515d6b3f9aa
--- /dev/null
+++ b/app/controllers/registrations/experience_levels_controller.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+module Registrations
+ class ExperienceLevelsController < ApplicationController
+ # This will need to be changed to simply 'devise' as part of
+ # https://gitlab.com/gitlab-org/growth/engineering/issues/64
+ layout 'devise_experimental_separate_sign_up_flow'
+
+ before_action :check_experiment_enabled
+ before_action :ensure_namespace_path_param
+
+ def update
+ current_user.experience_level = params[:experience_level]
+
+ if current_user.save
+ hide_advanced_issues
+ flash[:message] = I18n.t('devise.registrations.signed_up')
+ redirect_to group_path(params[:namespace_path])
+ else
+ render :show
+ end
+ end
+
+ private
+
+ def check_experiment_enabled
+ access_denied! unless experiment_enabled?(:onboarding_issues)
+ end
+
+ def ensure_namespace_path_param
+ redirect_to root_path unless params[:namespace_path].present?
+ end
+
+ def hide_advanced_issues
+ return unless current_user.user_preference.novice?
+
+ settings = cookies[:onboarding_issues_settings]
+ return unless settings
+
+ modified_settings = Gitlab::Json.parse(settings).merge(hideAdvanced: true)
+ cookies[:onboarding_issues_settings] = modified_settings.to_json
+ end
+ end
+end