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
f2be76f3
Commit
f2be76f3
authored
Mar 15, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added labels to the issue web hook
parent
4a81867d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
1 deletion
+32
-1
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+1
-0
app/models/label.rb
app/models/label.rb
+4
-0
changelogs/unreleased/add-labels-to-issue-hook.yml
changelogs/unreleased/add-labels-to-issue-hook.yml
+4
-0
doc/user/project/integrations/webhooks.md
doc/user/project/integrations/webhooks.md
+13
-1
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+10
-0
No files found.
app/models/concerns/issuable.rb
View file @
f2be76f3
...
...
@@ -261,6 +261,7 @@ module Issuable
user:
user
.
hook_attrs
,
project:
project
.
hook_attrs
,
object_attributes:
hook_attrs
,
labels:
labels
.
map
(
&
:hook_attrs
),
# DEPRECATED
repository:
project
.
hook_attrs
.
slice
(
:name
,
:url
,
:description
,
:homepage
)
}
...
...
app/models/label.rb
View file @
f2be76f3
...
...
@@ -169,6 +169,10 @@ class Label < ActiveRecord::Base
end
end
def
hook_attrs
attributes
end
private
def
issues_count
(
user
,
params
=
{})
...
...
changelogs/unreleased/add-labels-to-issue-hook.yml
0 → 100644
View file @
f2be76f3
---
title
:
Added labels array to the issue web hook returned object
merge_request
:
9972
author
:
doc/user/project/integrations/webhooks.md
View file @
f2be76f3
...
...
@@ -250,7 +250,19 @@ X-Gitlab-Event: Issue Hook
"name"
:
"User1"
,
"username"
:
"user1"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
}
},
"labels"
:
[{
"id"
:
206
,
"title"
:
"API"
,
"color"
:
"#ffffff"
,
"project_id"
:
14
,
"created_at"
:
"2013-12-03T17:15:43Z"
,
"updated_at"
:
"2013-12-03T17:15:43Z"
,
"template"
:
false
,
"description"
:
"API related issues"
,
"type"
:
"ProjectLabel"
,
"group_id"
:
41
}]
}
```
### Comment events
...
...
spec/models/concerns/issuable_spec.rb
View file @
f2be76f3
...
...
@@ -278,6 +278,16 @@ describe Issue, "Issuable" do
end
end
context
'issue has labels'
do
let
(
:labels
)
{
[
create
(
:label
),
create
(
:label
)]
}
before
{
issue
.
update_attribute
(
:labels
,
labels
)}
it
'includes labels in the hook data'
do
expect
(
data
[
:labels
]).
to
eq
(
labels
.
map
(
&
:hook_attrs
))
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
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