diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-03-15 15:29:16 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-03-15 15:29:16 +0000 |
commit | b7123a8f59fc6c5124c7e39f998cec9a6db5c690 (patch) | |
tree | dedbf85eb7aa4ac734bcb3b2374978b7af069c70 | |
parent | 18778503eaec61b840b6fc0dbf54022e322f4960 (diff) | |
parent | dd53a9c0132d48393ca11e29825b599a5a1454a7 (diff) | |
download | gitlab-ce-b7123a8f59fc6c5124c7e39f998cec9a6db5c690.tar.gz |
Merge branch '27271-missing-time-spent-in-issue-webhook' into 'master'
Include time tracking attributes in webhooks payload
Closes #27271
See merge request !9942
-rw-r--r-- | app/models/issue.rb | 8 | ||||
-rw-r--r-- | app/models/merge_request.rb | 5 | ||||
-rw-r--r-- | changelogs/unreleased/27271-missing-time-spent-in-issue-webhook.yml | 4 | ||||
-rw-r--r-- | spec/models/issue_spec.rb | 11 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 6 |
5 files changed, 31 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index dba9398a43c..1427fdc31a4 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 0f7b8311588..4759829a15c 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -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 diff --git a/changelogs/unreleased/27271-missing-time-spent-in-issue-webhook.yml b/changelogs/unreleased/27271-missing-time-spent-in-issue-webhook.yml new file mode 100644 index 00000000000..4ea52a70e89 --- /dev/null +++ b/changelogs/unreleased/27271-missing-time-spent-in-issue-webhook.yml @@ -0,0 +1,4 @@ +--- +title: Include time tracking attributes in webhooks payload +merge_request: 9942 +author: diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index f67fbe79bde..9ffcb88bafd 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -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 diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index fcaf4c71182..24e7c1b17d9 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -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 |