Commit 714d7ad0 authored by Kerri Miller's avatar Kerri Miller

Track task list item status changes

parent 531baf3b
......@@ -258,6 +258,11 @@ class IssuableBaseService < BaseService
invalidate_cache_counts(issuable, users: issuable.assignees.to_a)
after_update(issuable)
execute_hooks(issuable, 'update', old_associations: nil)
if issuable.is_a?(MergeRequest)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
.track_task_item_status_changed(user: current_user)
end
end
end
......
......@@ -18,6 +18,27 @@ RSpec.shared_examples 'updating a single task' do
update_issuable(description: "- [ ] Task 1\n- [ ] Task 2")
end
context 'usage counters' do
it 'update as expected' do
if try(:merge_request)
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.to receive(:track_task_item_status_changed).once.with(user: user)
else
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.not_to receive(:track_task_item_status_changed)
end
update_issuable(
update_task: {
index: 1,
checked: true,
line_source: '- [ ] Task 1',
line_number: 1
}
)
end
end
context 'when a task is marked as completed' do
before do
update_issuable(update_task: { index: 1, checked: true, line_source: '- [ ] Task 1', line_number: 1 })
......
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