Commit 3fa500bd authored by Alper Akgun's avatar Alper Akgun Committed by Vitaly Slobodin

Get Started page for the continuous onboarding experiment

parent 44fb7c26
This diff is collapsed.
<svg width="108" height="4" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="108" height="4" rx="2" fill="#C2B7E6"/></svg>
......@@ -3,7 +3,7 @@
module LearnGitlabHelper
def learn_gitlab_experiment_enabled?(project)
return false unless current_user
return false unless experiment_enabled_for_user?
return false unless continous_onboarding_experiment_enabled_for_user?
learn_gitlab_onboarding_available?(project)
end
......@@ -21,6 +21,11 @@ module LearnGitlabHelper
end
end
def continous_onboarding_experiment_enabled_for_user?
Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_a, subject: current_user) ||
Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_b, subject: current_user)
end
private
ACTION_ISSUE_IDS = {
......@@ -50,11 +55,6 @@ module LearnGitlabHelper
OnboardingProgress.find_by(namespace: project.namespace) # rubocop: disable CodeReuse/ActiveRecord
end
def experiment_enabled_for_user?
Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_a, subject: current_user) ||
Gitlab::Experimentation.in_experiment_group?(:learn_gitlab_b, subject: current_user)
end
def learn_gitlab_onboarding_available?(project)
OnboardingProgress.onboarding?(project.namespace) &&
LearnGitlab.new(current_user).available?
......
......@@ -51,6 +51,7 @@ Rails.application.routes.draw do
Gitlab.ee do
get :trial_getting_started, on: :collection
get :trial_onboarding_board, on: :collection
get :continuous_onboarding_getting_started, on: :collection
end
end
......
......@@ -14,6 +14,13 @@ module EE
render locals: { learn_gitlab_project: learn_gitlab_project }
end
def continuous_onboarding_getting_started
project = ::Project.find(params[:project_id])
return access_denied! unless current_user.id == project.creator_id
render locals: { project: project }
end
def trial_onboarding_board
project = learn_gitlab_project
return access_denied! unless current_user.id == project.creator_id
......
......@@ -2,6 +2,7 @@
module Registrations
class ProjectsController < ApplicationController
include LearnGitlabHelper
layout 'checkout'
LEARN_GITLAB_TEMPLATE = 'learn_gitlab.tar.gz'
......@@ -40,7 +41,11 @@ module Registrations
redirect_to trial_getting_started_users_sign_up_welcome_path(learn_gitlab_project_id: learn_gitlab_project.id)
else
redirect_to users_sign_up_experience_level_path(namespace_path: @project.namespace)
if continous_onboarding_experiment_enabled_for_user?
redirect_to continuous_onboarding_getting_started_users_sign_up_welcome_path(project_id: @project.id)
else
redirect_to users_sign_up_experience_level_path(namespace_path: @project.namespace)
end
end
else
render :new
......
- return unless project
- page_title _('Get started with GitLab')
.row.gl-flex-grow-1.gl-p-5
.gl-display-flex.gl-flex-direction-column.gl-align-items-center.gl-w-full
.gl-display-flex.gl-flex-direction-column.gl-align-items-center.gl-pt-7.gl-mt-7.mw-460
= image_tag 'learn-gitlab-avatar.jpg', width: '90'
%h2.gl-text-center.gl-my-5= _('Get started with GitLab')
%p.gl-text-center.gl-text-gray-700.gl-mb-7= _('Ready to get started with GitLab? Follow these steps to set up your workspace, plan and commit changes, and deploy your project.')
= image_tag 'learn_gitlab/get_started.svg', width: '400', class: 'gl-max-w-full'
%div= link_to s_("Ok, let's go"), project_learn_gitlab_path(project), class: 'btn btn-success gl-button gl-mt-7'
......@@ -7,6 +7,32 @@ RSpec.describe Registrations::WelcomeController do
let_it_be(:another_user) { create(:user) }
let_it_be(:project) { create(:project, creator: user) }
describe '#continuous_onboarding_getting_started' do
subject(:continuous_onboarding_getting_started) do
get :continuous_onboarding_getting_started, params: { project_id: project.id }
end
context 'without a signed in user' do
it { is_expected.to redirect_to new_user_session_path }
end
context 'with the creator user signed in' do
before do
sign_in(user)
end
it { is_expected.to render_template(:continuous_onboarding_getting_started) }
end
context 'with any other user signed in except the creator' do
before do
sign_in(another_user)
end
it { is_expected.to have_gitlab_http_status(:not_found) }
end
end
describe '#trial_getting_started' do
subject(:trial_getting_started) do
get :trial_getting_started, params: { learn_gitlab_project_id: project.id }
......@@ -16,16 +42,12 @@ RSpec.describe Registrations::WelcomeController do
it { is_expected.to redirect_to new_user_session_path }
end
context 'with the creator user signed' do
context 'with the creator user signed in' do
before do
sign_in(user)
end
it 'sets the learn_gitlab_project and renders' do
subject
is_expected.to render_template(:trial_getting_started)
end
it { is_expected.to render_template(:trial_getting_started) }
end
context 'with any other user signed in except the creator' do
......@@ -33,11 +55,7 @@ RSpec.describe Registrations::WelcomeController do
sign_in(another_user)
end
it 'renders 404' do
subject
is_expected.to have_gitlab_http_status(:not_found)
end
it { is_expected.to have_gitlab_http_status(:not_found) }
end
end
......@@ -55,14 +73,10 @@ RSpec.describe Registrations::WelcomeController do
sign_in(another_user)
end
it 'renders 404' do
subject
is_expected.to have_gitlab_http_status(:not_found)
end
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'with the creator user signed' do
context 'with the creator user signed in' do
before do
sign_in(user)
end
......
......@@ -25952,6 +25952,9 @@ msgstr ""
msgid "Read more about related issues"
msgstr ""
msgid "Ready to get started with GitLab? Follow these steps to set up your workspace, plan and commit changes, and deploy your project."
msgstr ""
msgid "Real-time features"
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