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
04a65474
Commit
04a65474
authored
Jan 27, 2022
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'limit-cc-verification-experiment-to-new-users' into 'master'"
This reverts merge request !78987
parent
a5593cee
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
30 additions
and
75 deletions
+30
-75
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+0
-8
app/experiments/require_verification_for_namespace_creation_experiment.rb
...require_verification_for_namespace_creation_experiment.rb
+0
-10
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+1
-1
config/feature_flags/experiment/require_verification_for_group_creation.yml
...gs/experiment/require_verification_for_group_creation.yml
+8
-0
ee/app/helpers/ee/groups_helper.rb
ee/app/helpers/ee/groups_helper.rb
+8
-4
ee/app/services/ee/groups/create_service.rb
ee/app/services/ee/groups/create_service.rb
+1
-1
ee/spec/features/groups/new_spec.rb
ee/spec/features/groups/new_spec.rb
+1
-1
ee/spec/helpers/ee/groups_helper_spec.rb
ee/spec/helpers/ee/groups_helper_spec.rb
+3
-3
ee/spec/services/groups/create_service_spec.rb
ee/spec/services/groups/create_service_spec.rb
+7
-7
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+0
-23
spec/experiments/require_verification_for_namespace_creation_experiment_spec.rb
...re_verification_for_namespace_creation_experiment_spec.rb
+1
-17
No files found.
app/controllers/groups_controller.rb
View file @
04a65474
...
...
@@ -38,8 +38,6 @@ class GroupsController < Groups::ApplicationController
before_action
:check_export_rate_limit!
,
only:
[
:export
,
:download_export
]
before_action
:track_experiment_event
,
only:
[
:new
]
helper_method
:captcha_required?
skip_cross_project_access_check
:index
,
:new
,
:create
,
:edit
,
:update
,
...
...
@@ -380,12 +378,6 @@ class GroupsController < Groups::ApplicationController
def
captcha_required?
captcha_enabled?
&&
!
params
[
:parent_id
]
end
def
track_experiment_event
return
if
params
[
:parent_id
]
experiment
(
:require_verification_for_namespace_creation
,
user:
current_user
).
track
(
:start_create_group
)
end
end
GroupsController
.
prepend_mod_with
(
'GroupsController'
)
app/experiments/require_verification_for_namespace_creation_experiment.rb
View file @
04a65474
# frozen_string_literal: true
class
RequireVerificationForNamespaceCreationExperiment
<
ApplicationExperiment
# rubocop:disable Gitlab/NamespacedClass
exclude
:existing_user
EXPERIMENT_START_DATE
=
Date
.
new
(
2022
,
1
,
31
)
def
control_behavior
false
end
...
...
@@ -28,10 +24,4 @@ class RequireVerificationForNamespaceCreationExperiment < ApplicationExperiment
def
subject
context
.
value
[
:user
]
end
def
existing_user
return
false
unless
user_or_actor
user_or_actor
.
created_at
<
EXPERIMENT_START_DATE
end
end
app/helpers/groups_helper.rb
View file @
04a65474
...
...
@@ -139,7 +139,7 @@ module GroupsHelper
{}
end
def
require_verification_for_
namespace
_creation_enabled?
def
require_verification_for_
group
_creation_enabled?
# overridden in EE
false
end
...
...
config/feature_flags/experiment/require_verification_for_group_creation.yml
0 → 100644
View file @
04a65474
---
name
:
require_verification_for_group_creation
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77569
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/349857
milestone
:
'
14.7'
type
:
experiment
group
:
group::activation
default_enabled
:
false
ee/app/helpers/ee/groups_helper.rb
View file @
04a65474
...
...
@@ -60,18 +60,22 @@ module EE
!
params
[
:purchased_product
].
blank?
end
override
:require_verification_for_
namespace
_creation_enabled?
def
require_verification_for_
namespace
_creation_enabled?
override
:require_verification_for_
group
_creation_enabled?
def
require_verification_for_
group
_creation_enabled?
# Experiment should only run when creating top-level groups
return
false
if
params
[
:parent_id
]
experiment
(
:require_verification_for_namespace_creation
,
user:
current_user
).
run
experiment
(
:require_verification_for_group_creation
,
user:
current_user
)
do
|
e
|
e
.
candidate
{
true
}
e
.
control
{
false
}
e
.
run
end
end
override
:verification_for_group_creation_data
def
verification_for_group_creation_data
{
verification_required:
require_verification_for_
namespace
_creation_enabled?
.
to_s
,
verification_required:
require_verification_for_
group
_creation_enabled?
.
to_s
,
verification_form_url:
::
Gitlab
::
SubscriptionPortal
::
REGISTRATION_VALIDATION_FORM_URL
,
subscriptions_url:
::
Gitlab
::
SubscriptionPortal
::
SUBSCRIPTIONS_URL
}
...
...
ee/app/services/ee/groups/create_service.rb
View file @
04a65474
...
...
@@ -70,7 +70,7 @@ module EE
return
unless
group
.
persisted?
return
unless
group
.
root?
experiment
(
:require_verification_for_
namespace_creation
,
user:
current_user
).
track
(
:finish_create_group
,
namespace:
group
)
experiment
(
:require_verification_for_
group_creation
,
user:
current_user
).
track
(
:converted
,
namespace:
group
)
end
end
end
...
...
ee/spec/features/groups/new_spec.rb
View file @
04a65474
...
...
@@ -33,7 +33,7 @@ RSpec.describe 'New Group page' do
end
before
do
stub_experiments
(
require_verification_for_
namespace
_creation:
variant
)
stub_experiments
(
require_verification_for_
group
_creation:
variant
)
end
context
'when creating a top-level group'
do
...
...
ee/spec/helpers/ee/groups_helper_spec.rb
View file @
04a65474
...
...
@@ -223,13 +223,13 @@ RSpec.describe GroupsHelper do
end
end
describe
'#require_verification_for_
namespace
_creation_enabled?'
do
describe
'#require_verification_for_
group
_creation_enabled?'
do
let
(
:variant
)
{
:control
}
subject
{
helper
.
require_verification_for_
namespace
_creation_enabled?
}
subject
{
helper
.
require_verification_for_
group
_creation_enabled?
}
before
do
stub_experiments
(
require_verification_for_
namespace
_creation:
variant
)
stub_experiments
(
require_verification_for_
group
_creation:
variant
)
end
context
'when in candidate path'
do
...
...
ee/spec/services/groups/create_service_spec.rb
View file @
04a65474
...
...
@@ -163,16 +163,16 @@ RSpec.describe Groups::CreateService, '#execute' do
end
end
describe
'require_verification_for_
namespace
_creation experiment conversion tracking'
,
:experiment
do
describe
'require_verification_for_
group
_creation experiment conversion tracking'
,
:experiment
do
subject
(
:execute
)
{
create_group
(
user
,
group_params
)
}
before
do
stub_experiments
(
require_verification_for_
namespace
_creation: :control
)
stub_experiments
(
require_verification_for_
group
_creation: :control
)
end
it
'tracks a "
finish_create_group
" event with the correct context and payload'
do
expect
(
experiment
(
:require_verification_for_
namespace
_creation
)).
to
track
(
:
finish_create_group
,
it
'tracks a "
converted
" event with the correct context and payload'
do
expect
(
experiment
(
:require_verification_for_
group
_creation
)).
to
track
(
:
converted
,
namespace:
an_instance_of
(
Group
)
).
on_next_instance
.
with_context
(
user:
user
)
...
...
@@ -180,8 +180,8 @@ RSpec.describe Groups::CreateService, '#execute' do
end
shared_examples
'does not track'
do
it
'does not track a "
finish_create_group
" event'
do
expect
(
experiment
(
:require_verification_for_
namespace_creation
)).
not_to
track
(
:finish_create_group
)
it
'does not track a "
converted
" event'
do
expect
(
experiment
(
:require_verification_for_
group_creation
)).
not_to
track
(
:converted
)
execute
end
...
...
spec/controllers/groups_controller_spec.rb
View file @
04a65474
...
...
@@ -132,29 +132,6 @@ RSpec.describe GroupsController, factory_default: :keep do
end
end
end
describe
'require_verification_for_namespace_creation experiment'
,
:experiment
do
before
do
sign_in
(
owner
)
stub_experiments
(
require_verification_for_namespace_creation: :candidate
)
end
it
'tracks a "start_create_group" event'
do
expect
(
experiment
(
:require_verification_for_namespace_creation
)).
to
track
(
:start_create_group
).
on_next_instance
.
with_context
(
user:
owner
)
get
:new
end
context
'when creating a sub-group'
do
it
'does not track a "start_create_group" event'
do
expect
(
experiment
(
:require_verification_for_namespace_creation
)).
not_to
track
(
:start_create_group
)
get
:new
,
params:
{
parent_id:
group
.
id
}
end
end
end
end
describe
'GET #activity'
do
...
...
spec/experiments/require_verification_for_namespace_creation_experiment_spec.rb
View file @
04a65474
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
RequireVerificationForNamespaceCreationExperiment
,
:experiment
do
subject
(
:experiment
)
{
described_class
.
new
(
user:
user
)
}
let
(
:user
)
{
create
(
:user
,
created_at:
RequireVerificationForNamespaceCreationExperiment
::
EXPERIMENT_START_DATE
+
1
.
hou
r
)
}
let
_it_be
(
:user
)
{
create
(
:use
r
)
}
describe
'#candidate?'
do
context
'when experiment subject is candidate'
do
...
...
@@ -56,20 +56,4 @@ RSpec.describe RequireVerificationForNamespaceCreationExperiment, :experiment do
end
end
end
describe
'exclusions'
do
context
'when user is new'
do
it
'is not excluded'
do
expect
(
subject
).
not_to
exclude
(
user:
user
)
end
end
context
'when user is NOT new'
do
let
(
:user
)
{
create
(
:user
,
created_at:
RequireVerificationForNamespaceCreationExperiment
::
EXPERIMENT_START_DATE
-
1
.
day
)
}
it
'is excluded'
do
expect
(
subject
).
to
exclude
(
user:
user
)
end
end
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