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
c8e5276f
Commit
c8e5276f
authored
Jan 18, 2022
by
Eugie Limpin
Committed by
Sincheol (David) Kim
Jan 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Event tracking for require_verification_for_group_creation experiment
parent
a2aa897b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
ee/app/services/ee/groups/create_service.rb
ee/app/services/ee/groups/create_service.rb
+9
-0
ee/spec/services/groups/create_service_spec.rb
ee/spec/services/groups/create_service_spec.rb
+43
-0
No files found.
ee/app/services/ee/groups/create_service.rb
View file @
c8e5276f
...
...
@@ -31,6 +31,8 @@ module EE
if
group
.
persisted?
&&
create_event
::
Groups
::
CreateEventWorker
.
perform_async
(
group
.
id
,
current_user
.
id
,
:created
)
end
track_verification_experiment_conversion
end
override
:remove_unallowed_params
...
...
@@ -63,6 +65,13 @@ module EE
group
.
update
(
push_rule:
push_rule
)
end
end
def
track_verification_experiment_conversion
return
unless
group
.
persisted?
return
unless
group
.
root?
experiment
(
:require_verification_for_group_creation
,
user:
current_user
).
track
(
:converted
,
namespace:
group
)
end
end
end
end
ee/spec/services/groups/create_service_spec.rb
View file @
c8e5276f
...
...
@@ -163,6 +163,49 @@ RSpec.describe Groups::CreateService, '#execute' do
end
end
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_group_creation: :control
)
end
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
)
execute
end
shared_examples
'does not track'
do
it
'does not track a "converted" event'
do
expect
(
experiment
(
:require_verification_for_group_creation
)).
not_to
track
(
:converted
)
execute
end
end
context
'when group has not been persisted'
do
subject
(
:execute
)
{
create_group
(
user
,
group_params
.
merge
(
name:
'<script>alert("Attack!")</script>'
))
}
include_examples
'does not track'
end
context
'when created group is a sub-group'
do
let
(
:parent_group
)
{
create
:group
}
subject
(
:execute
)
{
create_group
(
user
,
group_params
.
merge
(
parent_id:
parent_group
.
id
))
}
before
do
parent_group
.
add_owner
(
user
)
end
include_examples
'does not track'
end
end
def
create_group
(
user
,
opts
)
described_class
.
new
(
user
,
opts
).
execute
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