Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f2be76f3
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f2be76f3
编写于
3月 15, 2017
作者:
L
Luke "Jared" Bennett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added labels to the issue web hook
上级
4a81867d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
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
未找到文件。
app/models/concerns/issuable.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
f2be76f3
---
title
:
Added labels array to the issue web hook returned object
merge_request
:
9972
author
:
doc/user/project/integrations/webhooks.md
浏览文件 @
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
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录