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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ed8a00b9
Commit
ed8a00b9
authored
Jun 08, 2019
by
Sujay Patel
Committed by
sujay
Jun 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding labels to note event payload.
parent
6aa0df5a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
2 deletions
+37
-2
changelogs/unreleased/33064-add-labels-to-note-event-payload.yml
...ogs/unreleased/33064-add-labels-to-note-event-payload.yml
+5
-0
doc/user/project/integrations/webhooks.md
doc/user/project/integrations/webhooks.md
+27
-1
lib/gitlab/data_builder/note.rb
lib/gitlab/data_builder/note.rb
+1
-0
lib/gitlab/hook_data/issue_builder.rb
lib/gitlab/hook_data/issue_builder.rb
+2
-1
spec/lib/gitlab/data_builder/note_spec.rb
spec/lib/gitlab/data_builder/note_spec.rb
+2
-0
No files found.
changelogs/unreleased/33064-add-labels-to-note-event-payload.yml
0 → 100644
View file @
ed8a00b9
---
title
:
Add labels to note event payload
merge_request
:
29384
author
:
Sujay Patel
type
:
added
doc/user/project/integrations/webhooks.md
View file @
ed8a00b9
...
@@ -653,7 +653,33 @@ X-Gitlab-Event: Note Hook
...
@@ -653,7 +653,33 @@ X-Gitlab-Event: Note Hook
"description"
:
"test"
,
"description"
:
"test"
,
"milestone_id"
:
null
,
"milestone_id"
:
null
,
"state"
:
"closed"
,
"state"
:
"closed"
,
"iid"
:
17
"iid"
:
17
,
"labels"
:
[
{
"id"
:
25
,
"title"
:
"Afterpod"
,
"color"
:
"#3e8068"
,
"project_id"
:
null
,
"created_at"
:
"2019-06-05T14:32:20.211Z"
,
"updated_at"
:
"2019-06-05T14:32:20.211Z"
,
"template"
:
false
,
"description"
:
null
,
"type"
:
"GroupLabel"
,
"group_id"
:
4
},
{
"id"
:
86
,
"title"
:
"Element"
,
"color"
:
"#231afe"
,
"project_id"
:
4
,
"created_at"
:
"2019-06-05T14:32:20.637Z"
,
"updated_at"
:
"2019-06-05T14:32:20.637Z"
,
"template"
:
false
,
"description"
:
null
,
"type"
:
"ProjectLabel"
,
"group_id"
:
null
}
],
}
}
}
}
```
```
...
...
lib/gitlab/data_builder/note.rb
View file @
ed8a00b9
...
@@ -44,6 +44,7 @@ module Gitlab
...
@@ -44,6 +44,7 @@ module Gitlab
data
[
:commit
]
=
build_data_for_commit
(
project
,
user
,
note
)
data
[
:commit
]
=
build_data_for_commit
(
project
,
user
,
note
)
elsif
note
.
for_issue?
elsif
note
.
for_issue?
data
[
:issue
]
=
note
.
noteable
.
hook_attrs
data
[
:issue
]
=
note
.
noteable
.
hook_attrs
data
[
:issue
][
:labels
]
=
note
.
noteable
.
labels
(
&
:hook_attrs
)
elsif
note
.
for_merge_request?
elsif
note
.
for_merge_request?
data
[
:merge_request
]
=
note
.
noteable
.
hook_attrs
data
[
:merge_request
]
=
note
.
noteable
.
hook_attrs
elsif
note
.
for_snippet?
elsif
note
.
for_snippet?
...
...
lib/gitlab/hook_data/issue_builder.rb
View file @
ed8a00b9
...
@@ -44,7 +44,8 @@ module Gitlab
...
@@ -44,7 +44,8 @@ module Gitlab
human_total_time_spent:
issue
.
human_total_time_spent
,
human_total_time_spent:
issue
.
human_total_time_spent
,
human_time_estimate:
issue
.
human_time_estimate
,
human_time_estimate:
issue
.
human_time_estimate
,
assignee_ids:
issue
.
assignee_ids
,
assignee_ids:
issue
.
assignee_ids
,
assignee_id:
issue
.
assignee_ids
.
first
# This key is deprecated
assignee_id:
issue
.
assignee_ids
.
first
,
# This key is deprecated
labels:
issue
.
labels
}
}
issue
.
attributes
.
with_indifferent_access
.
slice
(
*
self
.
class
.
safe_hook_attributes
)
issue
.
attributes
.
with_indifferent_access
.
slice
(
*
self
.
class
.
safe_hook_attributes
)
...
...
spec/lib/gitlab/data_builder/note_spec.rb
View file @
ed8a00b9
...
@@ -53,6 +53,8 @@ describe Gitlab::DataBuilder::Note do
...
@@ -53,6 +53,8 @@ describe Gitlab::DataBuilder::Note do
.
to
eq
(
issue
.
reload
.
hook_attrs
.
except
(
'updated_at'
))
.
to
eq
(
issue
.
reload
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:issue
][
'updated_at'
])
expect
(
data
[
:issue
][
'updated_at'
])
.
to
be
>=
issue
.
hook_attrs
[
'updated_at'
]
.
to
be
>=
issue
.
hook_attrs
[
'updated_at'
]
expect
(
data
[
:issue
][
'labels'
])
.
to
eq
(
issue
.
hook_attrs
[
'labels'
])
end
end
context
'with confidential issue'
do
context
'with confidential issue'
do
...
...
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