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
6d4d248e
Commit
6d4d248e
authored
Feb 05, 2021
by
Kerri Miller
Committed by
Robert Speicher
Feb 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MR title & desc tracking events
Add basic tracking events for MR title and description changes
parent
29cc6466
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
0 deletions
+80
-0
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+15
-0
config/feature_flags/development/usage_data_i_code_review_edit_mr_desc.yml
...ags/development/usage_data_i_code_review_edit_mr_desc.yml
+8
-0
config/feature_flags/development/usage_data_i_code_review_edit_mr_title.yml
...gs/development/usage_data_i_code_review_edit_mr_title.yml
+8
-0
lib/gitlab/usage_data_counters/known_events/common.yml
lib/gitlab/usage_data_counters/known_events/common.yml
+10
-0
lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
...ge_data_counters/merge_request_activity_unique_counter.rb
+10
-0
spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
...ta_counters/merge_request_activity_unique_counter_spec.rb
+16
-0
spec/services/merge_requests/update_service_spec.rb
spec/services/merge_requests/update_service_spec.rb
+13
-0
No files found.
app/services/merge_requests/update_service.rb
View file @
6d4d248e
...
@@ -87,8 +87,23 @@ module MergeRequests
...
@@ -87,8 +87,23 @@ module MergeRequests
MergeRequests
::
CloseService
MergeRequests
::
CloseService
end
end
def
before_update
(
issuable
,
skip_spam_check:
false
)
return
unless
issuable
.
changed?
@issuable_changes
=
issuable
.
changes
end
def
after_update
(
issuable
)
def
after_update
(
issuable
)
issuable
.
cache_merge_request_closes_issues!
(
current_user
)
issuable
.
cache_merge_request_closes_issues!
(
current_user
)
return
unless
@issuable_changes
%w(title description)
.
each
do
|
action
|
next
unless
@issuable_changes
.
key?
(
action
)
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
.
public_send
(
"track_
#{
action
}
_edit_action"
.
to_sym
,
user:
current_user
)
# rubocop:disable GitlabSecurity/PublicSend
end
end
end
private
private
...
...
config/feature_flags/development/usage_data_i_code_review_edit_mr_desc.yml
0 → 100644
View file @
6d4d248e
---
name
:
usage_data_i_code_review_edit_mr_desc
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/292830
rollout_issue_url
:
milestone
:
'
13.9'
type
:
development
group
:
group::code review
default_enabled
:
true
config/feature_flags/development/usage_data_i_code_review_edit_mr_title.yml
0 → 100644
View file @
6d4d248e
---
name
:
usage_data_i_code_review_edit_mr_title
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/292830
rollout_issue_url
:
milestone
:
'
13.9'
type
:
development
group
:
group::code review
default_enabled
:
true
lib/gitlab/usage_data_counters/known_events/common.yml
View file @
6d4d248e
...
@@ -496,6 +496,16 @@
...
@@ -496,6 +496,16 @@
category
:
code_review
category
:
code_review
aggregation
:
weekly
aggregation
:
weekly
feature_flag
:
usage_data_i_code_review_user_unresolve_thread
feature_flag
:
usage_data_i_code_review_user_unresolve_thread
-
name
:
i_code_review_edit_mr_title
redis_slot
:
code_review
category
:
code_review
aggregation
:
weekly
feature_flag
:
usage_data_i_code_review_edit_mr_title
-
name
:
i_code_review_edit_mr_desc
redis_slot
:
code_review
category
:
code_review
aggregation
:
weekly
feature_flag
:
usage_data_i_code_review_edit_mr_desc
-
name
:
i_code_review_user_merge_mr
-
name
:
i_code_review_user_merge_mr
redis_slot
:
code_review
redis_slot
:
code_review
category
:
code_review
category
:
code_review
...
...
lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
View file @
6d4d248e
...
@@ -24,6 +24,8 @@ module Gitlab
...
@@ -24,6 +24,8 @@ module Gitlab
MR_UNRESOLVE_THREAD_ACTION
=
'i_code_review_user_unresolve_thread'
MR_UNRESOLVE_THREAD_ACTION
=
'i_code_review_user_unresolve_thread'
MR_ASSIGNED_USERS_ACTION
=
'i_code_review_user_assigned'
MR_ASSIGNED_USERS_ACTION
=
'i_code_review_user_assigned'
MR_REVIEW_REQUESTED_USERS_ACTION
=
'i_code_review_user_review_requested'
MR_REVIEW_REQUESTED_USERS_ACTION
=
'i_code_review_user_review_requested'
MR_EDIT_MR_TITLE_ACTION
=
'i_code_review_edit_mr_title'
MR_EDIT_MR_DESC_ACTION
=
'i_code_review_edit_mr_desc'
class
<<
self
class
<<
self
def
track_mr_diffs_action
(
merge_request
:)
def
track_mr_diffs_action
(
merge_request
:)
...
@@ -98,6 +100,14 @@ module Gitlab
...
@@ -98,6 +100,14 @@ module Gitlab
track_unique_action_by_users
(
MR_REVIEW_REQUESTED_USERS_ACTION
,
users
)
track_unique_action_by_users
(
MR_REVIEW_REQUESTED_USERS_ACTION
,
users
)
end
end
def
track_title_edit_action
(
user
:)
track_unique_action_by_user
(
MR_EDIT_MR_TITLE_ACTION
,
user
)
end
def
track_description_edit_action
(
user
:)
track_unique_action_by_user
(
MR_EDIT_MR_DESC_ACTION
,
user
)
end
private
private
def
track_unique_action_by_merge_request
(
action
,
merge_request
)
def
track_unique_action_by_merge_request
(
action
,
merge_request
)
...
...
spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
View file @
6d4d248e
...
@@ -89,6 +89,22 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
...
@@ -89,6 +89,22 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
end
end
end
end
describe
'.track_title_edit_action'
do
subject
{
described_class
.
track_title_edit_action
(
user:
user
)
}
it_behaves_like
'a tracked merge request unique event'
do
let
(
:action
)
{
described_class
::
MR_EDIT_MR_TITLE_ACTION
}
end
end
describe
'.track_description_edit_action'
do
subject
{
described_class
.
track_description_edit_action
(
user:
user
)
}
it_behaves_like
'a tracked merge request unique event'
do
let
(
:action
)
{
described_class
::
MR_EDIT_MR_DESC_ACTION
}
end
end
describe
'.track_create_comment_action'
do
describe
'.track_create_comment_action'
do
subject
{
described_class
.
track_create_comment_action
(
note:
note
)
}
subject
{
described_class
.
track_create_comment_action
(
note:
note
)
}
...
...
spec/services/merge_requests/update_service_spec.rb
View file @
6d4d248e
...
@@ -87,6 +87,19 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
...
@@ -87,6 +87,19 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
expect
(
@merge_request
.
discussion_locked
).
to
be_truthy
expect
(
@merge_request
.
discussion_locked
).
to
be_truthy
end
end
context
'usage counters'
do
let
(
:merge_request2
)
{
create
(
:merge_request
)
}
it
'update as expected'
do
expect
(
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
)
.
to
receive
(
:track_title_edit_action
).
once
.
with
(
user:
user
)
expect
(
Gitlab
::
UsageDataCounters
::
MergeRequestActivityUniqueCounter
)
.
to
receive
(
:track_description_edit_action
).
once
.
with
(
user:
user
)
MergeRequests
::
UpdateService
.
new
(
project
,
user
,
opts
).
execute
(
merge_request2
)
end
end
context
'updating milestone'
do
context
'updating milestone'
do
RSpec
.
shared_examples
'updates milestone'
do
RSpec
.
shared_examples
'updates milestone'
do
it
'sets milestone'
do
it
'sets milestone'
do
...
...
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