debian-mirror-gitlab/app/controllers/registrations/experience_levels_controller.rb

45 lines
1.1 KiB
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
module Registrations
class ExperienceLevelsController < ApplicationController
2021-03-11 19:13:27 +05:30
layout 'signup_onboarding'
2020-06-23 00:09:42 +05:30
before_action :ensure_namespace_path_param
2021-04-29 21:17:54 +05:30
feature_category :onboarding
2021-01-03 14:25:43 +05:30
2020-06-23 00:09:42 +05:30
def update
current_user.experience_level = params[:experience_level]
if current_user.save
hide_advanced_issues
2021-01-03 14:25:43 +05:30
2021-03-11 19:13:27 +05:30
if learn_gitlab.available?
2021-01-03 14:25:43 +05:30
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-23 00:09:42 +05:30
else
render :show
end
end
private
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?
2020-07-28 23:09:34 +05:30
return unless learn_gitlab.available?
2020-06-23 00:09:42 +05:30
2020-07-28 23:09:34 +05:30
Boards::UpdateService.new(learn_gitlab.project, current_user, label_ids: [learn_gitlab.label.id]).execute(learn_gitlab.board)
end
2020-06-23 00:09:42 +05:30
2020-07-28 23:09:34 +05:30
def learn_gitlab
@learn_gitlab ||= LearnGitlab.new(current_user)
2020-06-23 00:09:42 +05:30
end
end
end