Commit 4496d0f8 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch...

Merge branch '339513-track-resolve-this-thread-in-a-new-issue-button-in-merge-requests' into 'master'

Resolve "Track `resolve this thread in a new issue` button in merge requests"

See merge request gitlab-org/gitlab!69879
parents b37b191c b02e032a
......@@ -117,7 +117,11 @@ class Projects::IssuesController < Projects::ApplicationController
@issue = @noteable = service.execute
@merge_request_to_resolve_discussions_of = service.merge_request_to_resolve_discussions_of
@discussion_to_resolve = service.discussions_to_resolve.first if params[:discussion_to_resolve]
if params[:discussion_to_resolve]
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_resolve_thread_in_issue_action(user: current_user)
@discussion_to_resolve = service.discussions_to_resolve.first
end
respond_with(@issue)
end
......
......@@ -66,6 +66,7 @@
- 'i_code_review_user_load_conflict_ui'
- 'i_code_review_user_resolve_conflict'
- 'i_code_review_user_searches_diff'
- 'i_code_review_user_resolve_thread_in_issue'
- name: code_review_category_monthly_active_users
operator: OR
source: redis
......@@ -124,6 +125,7 @@
- 'i_code_review_user_load_conflict_ui'
- 'i_code_review_user_resolve_conflict'
- 'i_code_review_user_searches_diff'
- 'i_code_review_user_resolve_thread_in_issue'
- name: code_review_extension_category_monthly_active_users
operator: OR
source: redis
......
---
key_path: redis_hll_counters.code_review.i_code_review_user_resolve_thread_in_issue_monthly
name: resolve_thread_in_issue
description: The number of users who resolve a thread in a new issue through the MR page monthly
product_section: dev
product_stage: create
product_group: group::code review
product_category: code_review
value_type: number
status: active
milestone: "14.3"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69879
time_frame: 28d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- i_code_review_user_resolve_thread_in_issue
performance_indicator_type: []
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
key_path: redis_hll_counters.code_review.i_code_review_user_resolve_thread_in_issue_weekly
name: resolve_thread_in_issue
description: The number of users who resolve a thread in a new issue through the MR page weekly
product_section: dev
product_stage: create
product_group: group::code review
product_category: code_review
value_type: number
status: active
milestone: "14.3"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69879
time_frame: 7d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- i_code_review_user_resolve_thread_in_issue
performance_indicator_type: []
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
......@@ -245,3 +245,7 @@
redis_slot: code_review
category: code_review
aggregation: weekly
- name: i_code_review_user_resolve_thread_in_issue
redis_slot: code_review
category: code_review
aggregation: weekly
......@@ -48,6 +48,7 @@ module Gitlab
MR_LABELS_CHANGED_ACTION = 'i_code_review_user_labels_changed'
MR_LOAD_CONFLICT_UI_ACTION = 'i_code_review_user_load_conflict_ui'
MR_RESOLVE_CONFLICT_ACTION = 'i_code_review_user_resolve_conflict'
MR_RESOLVE_THREAD_IN_ISSUE_ACTION = 'i_code_review_user_resolve_thread_in_issue'
class << self
def track_mr_diffs_action(merge_request:)
......@@ -214,6 +215,10 @@ module Gitlab
track_unique_action_by_user(MR_RESOLVE_CONFLICT_ACTION, user)
end
def track_resolve_thread_in_issue_action(user:)
track_unique_action_by_user(MR_RESOLVE_THREAD_IN_ISSUE_ACTION, user)
end
private
def track_unique_action_by_merge_request(action, merge_request)
......
......@@ -309,6 +309,8 @@ RSpec.describe Projects::IssuesController do
it 'fills in an issue for a discussion' do
note = create(:note_on_merge_request, project: project)
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter).to receive(:track_resolve_thread_in_issue_action).with(user: user)
get :new, params: { namespace_id: project.namespace.path, project_id: project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id }
expect(assigns(:issue).title).not_to be_empty
......
......@@ -408,4 +408,12 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
let(:action) { described_class::MR_RESOLVE_CONFLICT_ACTION }
end
end
describe '.track_resolve_thread_in_issue_action' do
subject { described_class.track_resolve_thread_in_issue_action(user: user) }
it_behaves_like 'a tracked merge request unique event' do
let(:action) { described_class::MR_RESOLVE_THREAD_IN_ISSUE_ACTION }
end
end
end
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