2020-06-11 00:08:35 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Registrations
|
|
|
|
class ExperienceLevelsController < ApplicationController
|
2021-02-07 21:09:09 +00:00
|
|
|
layout 'signup_onboarding'
|
2020-06-11 00:08:35 +00:00
|
|
|
|
|
|
|
before_action :ensure_namespace_path_param
|
|
|
|
|
2021-04-01 12:08:56 +00:00
|
|
|
feature_category :onboarding
|
2020-10-05 12:08:47 +00:00
|
|
|
|
2020-06-11 00:08:35 +00:00
|
|
|
def update
|
|
|
|
current_user.experience_level = params[:experience_level]
|
|
|
|
|
|
|
|
if current_user.save
|
2020-06-15 18:08:43 +00:00
|
|
|
hide_advanced_issues
|
2020-10-15 00:08:42 +00:00
|
|
|
|
2021-02-01 21:09:15 +00:00
|
|
|
if learn_gitlab.available?
|
2020-10-15 00:08:42 +00:00
|
|
|
redirect_to namespace_project_board_path(params[:namespace_path], learn_gitlab.project, learn_gitlab.board)
|
|
|
|
else
|
|
|
|
redirect_to group_path(params[:namespace_path])
|
|
|
|
end
|
2020-06-11 00:08:35 +00:00
|
|
|
else
|
|
|
|
render :show
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def ensure_namespace_path_param
|
|
|
|
redirect_to root_path unless params[:namespace_path].present?
|
|
|
|
end
|
2020-06-15 18:08:43 +00:00
|
|
|
|
|
|
|
def hide_advanced_issues
|
|
|
|
return unless current_user.user_preference.novice?
|
2020-06-23 09:08:47 +00:00
|
|
|
return unless learn_gitlab.available?
|
2020-06-15 18:08:43 +00:00
|
|
|
|
2020-06-23 09:08:47 +00:00
|
|
|
Boards::UpdateService.new(learn_gitlab.project, current_user, label_ids: [learn_gitlab.label.id]).execute(learn_gitlab.board)
|
|
|
|
end
|
2020-06-15 18:08:43 +00:00
|
|
|
|
2020-06-23 09:08:47 +00:00
|
|
|
def learn_gitlab
|
|
|
|
@learn_gitlab ||= LearnGitlab.new(current_user)
|
2020-06-15 18:08:43 +00:00
|
|
|
end
|
2020-06-11 00:08:35 +00:00
|
|
|
end
|
|
|
|
end
|