Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
dd53a9c0
Commit
dd53a9c0
authored
Mar 14, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include time tracking attributes in webhooks payload
parent
ffcddb29
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
3 deletions
+31
-3
app/models/issue.rb
app/models/issue.rb
+7
-1
app/models/merge_request.rb
app/models/merge_request.rb
+4
-1
changelogs/unreleased/27271-missing-time-spent-in-issue-webhook.yml
.../unreleased/27271-missing-time-spent-in-issue-webhook.yml
+4
-0
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+11
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+5
-1
No files found.
app/models/issue.rb
View file @
dd53a9c0
...
@@ -58,7 +58,13 @@ class Issue < ActiveRecord::Base
...
@@ -58,7 +58,13 @@ class Issue < ActiveRecord::Base
end
end
def
hook_attrs
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
end
def
self
.
reference_prefix
def
self
.
reference_prefix
...
...
app/models/merge_request.rb
View file @
dd53a9c0
...
@@ -523,7 +523,10 @@ class MergeRequest < ActiveRecord::Base
...
@@ -523,7 +523,10 @@ class MergeRequest < ActiveRecord::Base
source:
source_project
.
try
(
:hook_attrs
),
source:
source_project
.
try
(
:hook_attrs
),
target:
target_project
.
hook_attrs
,
target:
target_project
.
hook_attrs
,
last_commit:
nil
,
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
if
diff_head_commit
...
...
changelogs/unreleased/27271-missing-time-spent-in-issue-webhook.yml
0 → 100644
View file @
dd53a9c0
---
title
:
Include time tracking attributes in webhooks payload
merge_request
:
9942
author
:
spec/models/issue_spec.rb
View file @
dd53a9c0
...
@@ -620,4 +620,15 @@ describe Issue, models: true do
...
@@ -620,4 +620,15 @@ describe Issue, models: true do
end
end
end
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
end
spec/models/merge_request_spec.rb
View file @
dd53a9c0
...
@@ -542,7 +542,7 @@ describe MergeRequest, models: true do
...
@@ -542,7 +542,7 @@ describe MergeRequest, models: true do
end
end
describe
"#hook_attrs"
do
describe
"#hook_attrs"
do
let
(
:attrs_hash
)
{
subject
.
hook_attrs
.
to_h
}
let
(
:attrs_hash
)
{
subject
.
hook_attrs
}
[
:source
,
:target
].
each
do
|
key
|
[
:source
,
:target
].
each
do
|
key
|
describe
"
#{
key
}
key"
do
describe
"
#{
key
}
key"
do
...
@@ -558,6 +558,10 @@ describe MergeRequest, models: true do
...
@@ -558,6 +558,10 @@ describe MergeRequest, models: true do
expect
(
attrs_hash
).
to
include
(
:target
)
expect
(
attrs_hash
).
to
include
(
:target
)
expect
(
attrs_hash
).
to
include
(
:last_commit
)
expect
(
attrs_hash
).
to
include
(
:last_commit
)
expect
(
attrs_hash
).
to
include
(
:work_in_progress
)
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
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment