Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
16ceaddc
Commit
16ceaddc
authored
Mar 03, 2021
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Social sign in options to trial registration
parent
bcb7a223
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
20 additions
and
55 deletions
+20
-55
app/helpers/auth_helper.rb
app/helpers/auth_helper.rb
+3
-2
app/views/devise/shared/_signup_omniauth_providers_top.haml
app/views/devise/shared/_signup_omniauth_providers_top.haml
+1
-1
ee/app/controllers/registrations/groups_controller.rb
ee/app/controllers/registrations/groups_controller.rb
+0
-2
ee/app/controllers/trials_controller.rb
ee/app/controllers/trials_controller.rb
+0
-12
ee/app/helpers/ee/trial_registration_helper.rb
ee/app/helpers/ee/trial_registration_helper.rb
+2
-3
ee/app/views/trial_registrations/new.html.haml
ee/app/views/trial_registrations/new.html.haml
+1
-1
ee/changelogs/unreleased/323227-experiment-cleanup-experiment-with-adding-social-sign-in-option.yml
...-cleanup-experiment-with-adding-social-sign-in-option.yml
+5
-0
ee/config/feature_flags/experiment/trial_registration_with_social_signin_experiment_percentage.yml
...registration_with_social_signin_experiment_percentage.yml
+0
-8
ee/spec/controllers/registrations/groups_controller_spec.rb
ee/spec/controllers/registrations/groups_controller_spec.rb
+0
-2
ee/spec/controllers/trials_controller_spec.rb
ee/spec/controllers/trials_controller_spec.rb
+0
-11
ee/spec/helpers/ee/trial_registration_helper_spec.rb
ee/spec/helpers/ee/trial_registration_helper_spec.rb
+4
-6
lib/gitlab/experimentation.rb
lib/gitlab/experimentation.rb
+0
-3
spec/helpers/auth_helper_spec.rb
spec/helpers/auth_helper_spec.rb
+4
-4
No files found.
app/helpers/auth_helper.rb
View file @
16ceaddc
...
...
@@ -16,6 +16,7 @@ module AuthHelper
twitter
)
.
freeze
LDAP_PROVIDER
=
/\Aldap/
.
freeze
TRIAL_REGISTRATION_PROVIDERS
=
%w(google_oauth2 github)
.
freeze
def
ldap_enabled?
Gitlab
::
Auth
::
Ldap
::
Config
.
enabled?
...
...
@@ -126,8 +127,8 @@ module AuthHelper
end
end
def
experiment
_enabled_button_based_providers
enabled_button_based_providers
&
%w(google_oauth2 github)
.
freeze
def
trial
_enabled_button_based_providers
enabled_button_based_providers
&
TRIAL_REGISTRATION_PROVIDERS
end
def
button_based_providers_enabled?
...
...
app/views/devise/shared/_signup_omniauth_providers_top.haml
View file @
16ceaddc
=
render
'devise/shared/signup_omniauth_provider_list'
,
providers:
experiment
_enabled_button_based_providers
=
render
'devise/shared/signup_omniauth_provider_list'
,
providers:
trial
_enabled_button_based_providers
.omniauth-divider.d-flex.align-items-center.text-center
=
_
(
"or"
)
ee/app/controllers/registrations/groups_controller.rb
View file @
16ceaddc
...
...
@@ -57,10 +57,8 @@ module Registrations
def
apply_trial_for_trial_onboarding_flow
if
apply_trial
record_experiment_user
(
:remove_known_trial_form_fields
,
namespace_id:
@group
.
id
)
record_experiment_user
(
:trial_registration_with_social_signin
,
namespace_id:
@group
.
id
)
record_experiment_user
(
:trial_onboarding_issues
,
namespace_id:
@group
.
id
)
record_experiment_conversion_event
(
:remove_known_trial_form_fields
)
record_experiment_conversion_event
(
:trial_registration_with_social_signin
)
record_experiment_conversion_event
(
:trial_onboarding_issues
)
experiment
(
:registrations_group_invite
,
actor:
current_user
)
do
|
experiment_instance
|
...
...
ee/app/controllers/trials_controller.rb
View file @
16ceaddc
...
...
@@ -13,7 +13,6 @@ class TrialsController < ApplicationController
def
new
record_experiment_user
(
:remove_known_trial_form_fields
,
remove_known_trial_form_fields_context
)
record_experiment_user
(
:trial_registration_with_social_signin
,
trial_registration_with_social_signin_context
)
end
def
select
...
...
@@ -40,10 +39,8 @@ class TrialsController < ApplicationController
if
@result
&
.
dig
(
:success
)
record_experiment_user
(
:remove_known_trial_form_fields
,
namespace_id:
@namespace
.
id
)
record_experiment_user
(
:trial_registration_with_social_signin
,
namespace_id:
@namespace
.
id
)
record_experiment_user
(
:trial_onboarding_issues
,
namespace_id:
@namespace
.
id
)
record_experiment_conversion_event
(
:remove_known_trial_form_fields
)
record_experiment_conversion_event
(
:trial_registration_with_social_signin
)
record_experiment_conversion_event
(
:trial_onboarding_issues
)
redirect_to
group_url
(
@namespace
,
{
trial:
true
})
...
...
@@ -127,13 +124,4 @@ class TrialsController < ApplicationController
company_name_present:
current_user
.
organization
.
present?
}
end
def
trial_registration_with_social_signin_context
identities
=
current_user
.
identities
.
map
(
&
:provider
)
{
google_signon:
identities
.
include?
(
'google_oauth2'
),
github_signon:
identities
.
include?
(
'github'
)
}
end
end
ee/app/helpers/ee/trial_registration_helper.rb
View file @
16ceaddc
...
...
@@ -2,12 +2,11 @@
module
EE
module
TrialRegistrationHelper
def
social_signin_e
xperiment_e
nabled?
def
social_signin_enabled?
::
Gitlab
.
com?
&&
omniauth_enabled?
&&
devise_mapping
.
omniauthable?
&&
button_based_providers_enabled?
&&
experiment_enabled?
(
:trial_registration_with_social_signin
)
button_based_providers_enabled?
end
end
end
ee/app/views/trial_registrations/new.html.haml
View file @
16ceaddc
...
...
@@ -11,7 +11,7 @@
=
render
'devise/shared/signup_box'
,
url:
trial_registrations_path
,
button_text:
_
(
'Continue'
),
show_omniauth_providers:
social_signin_e
xperiment_e
nabled?
,
show_omniauth_providers:
social_signin_enabled?
,
omniauth_providers_placement: :top
=
render
'devise/shared/sign_in_link'
ee/changelogs/unreleased/323227-experiment-cleanup-experiment-with-adding-social-sign-in-option.yml
0 → 100644
View file @
16ceaddc
---
title
:
Social sign in options to trial registration
merge_request
:
55533
author
:
type
:
added
ee/config/feature_flags/experiment/trial_registration_with_social_signin_experiment_percentage.yml
deleted
100644 → 0
View file @
bcb7a223
---
name
:
trial_registration_with_social_signin_experiment_percentage
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45633
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/262853
milestone
:
'
13.7'
type
:
experiment
group
:
group::conversion
default_enabled
:
false
ee/spec/controllers/registrations/groups_controller_spec.rb
View file @
16ceaddc
...
...
@@ -142,10 +142,8 @@ RSpec.describe Registrations::GroupsController do
expect
(
service
).
to
receive
(
:execute
).
with
(
apply_trial_params
).
and_return
({
success:
true
})
end
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:remove_known_trial_form_fields
,
namespace_id:
group
.
id
)
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:trial_registration_with_social_signin
,
namespace_id:
group
.
id
)
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:trial_onboarding_issues
,
namespace_id:
group
.
id
)
expect
(
controller
).
to
receive
(
:record_experiment_conversion_event
).
with
(
:remove_known_trial_form_fields
)
expect
(
controller
).
to
receive
(
:record_experiment_conversion_event
).
with
(
:trial_registration_with_social_signin
)
expect
(
controller
).
to
receive
(
:record_experiment_conversion_event
).
with
(
:trial_onboarding_issues
)
end
...
...
ee/spec/controllers/trials_controller_spec.rb
View file @
16ceaddc
...
...
@@ -12,13 +12,6 @@ RSpec.describe TrialsController do
}
end
let_it_be
(
:trial_registration_with_social_signin_context
)
do
{
google_signon:
user
.
identities
.
select
{
|
id
|
id
.
provider
==
'google_auth2'
}.
present?
,
github_signon:
user
.
identities
.
select
{
|
id
|
id
.
provider
==
'github'
}.
present?
}
end
let
(
:dev_env_or_com
)
{
true
}
let
(
:logged_in
)
{
true
}
...
...
@@ -63,7 +56,6 @@ RSpec.describe TrialsController do
it
'calls record_experiment_user for the experiments'
do
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:remove_known_trial_form_fields
,
remove_known_trial_form_fields_context
)
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:trial_registration_with_social_signin
,
trial_registration_with_social_signin_context
)
subject
end
...
...
@@ -198,10 +190,8 @@ RSpec.describe TrialsController do
it
{
is_expected
.
to
redirect_to
(
"/
#{
namespace
.
path
}
?trial=true"
)
}
it
'calls the record conversion method for the experiments'
do
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:remove_known_trial_form_fields
,
namespace_id:
namespace
.
id
)
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:trial_registration_with_social_signin
,
namespace_id:
namespace
.
id
)
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:trial_onboarding_issues
,
namespace_id:
namespace
.
id
)
expect
(
controller
).
to
receive
(
:record_experiment_conversion_event
).
with
(
:remove_known_trial_form_fields
)
expect
(
controller
).
to
receive
(
:record_experiment_conversion_event
).
with
(
:trial_registration_with_social_signin
)
expect
(
controller
).
to
receive
(
:record_experiment_conversion_event
).
with
(
:trial_onboarding_issues
)
subject
...
...
@@ -222,7 +212,6 @@ RSpec.describe TrialsController do
it
{
is_expected
.
to
render_template
(
:select
)
}
it
'does not call the record conversion method for the experiments'
do
expect
(
controller
).
not_to
receive
(
:record_experiment_conversion_event
).
with
(
:remove_known_trial_form_fields
)
expect
(
controller
).
not_to
receive
(
:record_experiment_conversion_event
).
with
(
:trial_registration_with_social_signin
)
subject
end
...
...
ee/spec/helpers/ee/trial_registration_helper_spec.rb
View file @
16ceaddc
...
...
@@ -5,25 +5,23 @@ require 'spec_helper'
RSpec
.
describe
EE
::
TrialRegistrationHelper
do
using
RSpec
::
Parameterized
::
TableSyntax
describe
'#social_signin_e
xperiment_e
nabled?'
do
describe
'#social_signin_enabled?'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
com
)
allow
(
view
).
to
receive
(
:omniauth_enabled?
).
and_return
(
omniauth_enabled
)
allow
(
view
).
to
receive
(
:button_based_providers_enabled?
).
and_return
(
button_based_providers_enabled
)
allow
(
view
).
to
receive
(
:experiment_enabled?
).
with
(
:trial_registration_with_social_signin
).
and_return
(
experiment_enabled
)
allow
(
view
).
to
receive
(
:devise_mapping
).
and_return
(
double
(
omniauthable?:
omniauthable
))
end
subject
{
helper
.
social_signin_e
xperiment_e
nabled?
}
subject
{
helper
.
social_signin_enabled?
}
where
com:
[
true
,
false
],
omniauth_enabled:
[
true
,
false
],
omniauthable:
[
true
,
false
],
button_based_providers_enabled:
[
true
,
false
],
experiment_enabled:
[
true
,
false
]
button_based_providers_enabled:
[
true
,
false
]
with_them
do
let
(
:result
)
{
com
&&
omniauth_enabled
&&
button_based_providers_enabled
&&
experiment_enabled
&&
omniauthable
}
let
(
:result
)
{
com
&&
omniauth_enabled
&&
button_based_providers_enabled
&&
omniauthable
}
it
{
is_expected
.
to
eq
(
result
)
}
end
...
...
lib/gitlab/experimentation.rb
View file @
16ceaddc
...
...
@@ -53,9 +53,6 @@ module Gitlab
remove_known_trial_form_fields:
{
tracking_category:
'Growth::Conversion::Experiment::RemoveKnownTrialFormFields'
},
trial_registration_with_social_signin:
{
tracking_category:
'Growth::Conversion::Experiment::TrialRegistrationWithSocialSigning'
},
invite_members_empty_project_version_a:
{
tracking_category:
'Growth::Expansion::Experiment::InviteMembersEmptyProjectVersionA'
},
...
...
spec/helpers/auth_helper_spec.rb
View file @
16ceaddc
...
...
@@ -99,19 +99,19 @@ RSpec.describe AuthHelper do
end
end
describe
'
experiment
_enabled_button_based_providers'
do
describe
'
trial
_enabled_button_based_providers'
do
it
'returns the intersection set of github & google_oauth2 with enabled providers'
do
allow
(
helper
).
to
receive
(
:enabled_button_based_providers
)
{
%w(twitter github google_oauth2)
}
expect
(
helper
.
experiment
_enabled_button_based_providers
).
to
eq
(
%w(github google_oauth2)
)
expect
(
helper
.
trial
_enabled_button_based_providers
).
to
eq
(
%w(github google_oauth2)
)
allow
(
helper
).
to
receive
(
:enabled_button_based_providers
)
{
%w(google_oauth2 bitbucket)
}
expect
(
helper
.
experiment
_enabled_button_based_providers
).
to
eq
(
%w(google_oauth2)
)
expect
(
helper
.
trial
_enabled_button_based_providers
).
to
eq
(
%w(google_oauth2)
)
allow
(
helper
).
to
receive
(
:enabled_button_based_providers
)
{
%w(bitbucket)
}
expect
(
helper
.
experiment
_enabled_button_based_providers
).
to
be_empty
expect
(
helper
.
trial
_enabled_button_based_providers
).
to
be_empty
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment