提交 dd53a9c0 编写于 作者: R Ruben Davila

Include time tracking attributes in webhooks payload

上级 ffcddb29
......@@ -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:
......@@ -620,4 +620,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册