Commit b267299f authored by Ash McKenzie's avatar Ash McKenzie Committed by Ash McKenzie

Add A/B testing support to onboarding

As well as checking if we're gitlab.com and the
:user_onboarding feature flag is enabled, let's
roll the dice with an A/B test controlled by the
:experiment_growth_onboarding feature flag.
parent 9e05fcb8
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
class Dashboard::ProjectsController < Dashboard::ApplicationController class Dashboard::ProjectsController < Dashboard::ApplicationController
include ParamsBackwardCompatibility include ParamsBackwardCompatibility
include RendersMemberAccess include RendersMemberAccess
include OnboardingExperimentHelper
prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) } prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) }
before_action :set_non_archived_param before_action :set_non_archived_param
......
...@@ -5,23 +5,26 @@ module EE ...@@ -5,23 +5,26 @@ module EE
module ProjectsController module ProjectsController
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
include ::OnboardingExperimentHelper
private private
override :render_projects override :render_projects
def render_projects def render_projects
if show_onboarding_welcome_page? return redirect_to explore_onboarding_index_path if show_onboarding_welcome_page?
redirect_to explore_onboarding_index_path
else super
super
end
end end
def show_onboarding_welcome_page? def show_onboarding_welcome_page?
return false unless ::Gitlab.com? return false if onboarding_cookie_set?
return false if cookies['onboarding_dismissed'] == 'true' return false unless allow_access_to_onboarding?
!show_projects?(projects, params)
end
::Feature.enabled?(:user_onboarding) && !show_projects?(projects, params) def onboarding_cookie_set?
cookies['onboarding_dismissed'] == 'true'
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
class Explore::OnboardingController < Explore::ApplicationController class Explore::OnboardingController < Explore::ApplicationController
include ::OnboardingExperimentHelper
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_project! before_action :set_project!
...@@ -17,8 +19,6 @@ class Explore::OnboardingController < Explore::ApplicationController ...@@ -17,8 +19,6 @@ class Explore::OnboardingController < Explore::ApplicationController
end end
def get_onboarding_demo_project def get_onboarding_demo_project
if Gitlab.com? && Feature.enabled?(:user_onboarding) Project.find_by_full_path("gitlab-org/gitlab-ce") if allow_access_to_onboarding?
Project.find_by_full_path("gitlab-org/gitlab-ce")
end
end end
end end
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
module EE module EE
module ApplicationHelper module ApplicationHelper
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
include ::OnboardingExperimentHelper
DB_LAG_SHOW_THRESHOLD = 60 # seconds DB_LAG_SHOW_THRESHOLD = 60 # seconds
LOG_CURSOR_CHECK_TIME = ::Gitlab::Geo::LogCursor::Daemon::SECONDARY_CHECK_INTERVAL LOG_CURSOR_CHECK_TIME = ::Gitlab::Geo::LogCursor::Daemon::SECONDARY_CHECK_INTERVAL
EVENT_PROCESSING_TIME = 60.seconds EVENT_PROCESSING_TIME = 60.seconds
...@@ -118,7 +120,7 @@ module EE ...@@ -118,7 +120,7 @@ module EE
end end
def user_onboarding_enabled? def user_onboarding_enabled?
::Gitlab.com? && ::Feature.enabled?(:user_onboarding) allow_access_to_onboarding?
end end
private private
......
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