Commit b7123a8f authored by Douwe Maan's avatar Douwe Maan

Merge branch '27271-missing-time-spent-in-issue-webhook' into 'master'

Include time tracking attributes in webhooks payload

Closes #27271

See merge request !9942
parents 18778503 dd53a9c0
......@@ -58,7 +58,13 @@ class Issue < ActiveRecord::Base
end
def hook_attrs
attributes
attrs = {
total_time_spent: total_time_spent,
human_total_time_spent: human_total_time_spent,
human_time_estimate: human_time_estimate
}
attributes.merge!(attrs)
end
def self.reference_prefix
......
......@@ -523,7 +523,10 @@ class MergeRequest < ActiveRecord::Base
source: source_project.try(:hook_attrs),
target: target_project.hook_attrs,
last_commit: nil,
work_in_progress: work_in_progress?
work_in_progress: work_in_progress?,
total_time_spent: total_time_spent,
human_total_time_spent: human_total_time_spent,
human_time_estimate: human_time_estimate
}
if diff_head_commit
......
---
title: Include time tracking attributes in webhooks payload
merge_request: 9942
author:
......@@ -635,4 +635,15 @@ describe Issue, models: true do
end
end
end
describe '#hook_attrs' do
let(:attrs_hash) { subject.hook_attrs }
it 'includes time tracking attrs' do
expect(attrs_hash).to include(:total_time_spent)
expect(attrs_hash).to include(:human_time_estimate)
expect(attrs_hash).to include(:human_total_time_spent)
expect(attrs_hash).to include('time_estimate')
end
end
end
......@@ -542,7 +542,7 @@ describe MergeRequest, models: true do
end
describe "#hook_attrs" do
let(:attrs_hash) { subject.hook_attrs.to_h }
let(:attrs_hash) { subject.hook_attrs }
[:source, :target].each do |key|
describe "#{key} key" do
......@@ -558,6 +558,10 @@ describe MergeRequest, models: true do
expect(attrs_hash).to include(:target)
expect(attrs_hash).to include(:last_commit)
expect(attrs_hash).to include(:work_in_progress)
expect(attrs_hash).to include(:total_time_spent)
expect(attrs_hash).to include(:human_time_estimate)
expect(attrs_hash).to include(:human_total_time_spent)
expect(attrs_hash).to include('time_estimate')
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