Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d146d9fd
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 搜索 >>
提交
d146d9fd
编写于
10月 18, 2015
作者:
B
Bram Daams
提交者:
Rémy Coutable
2月 10, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add assignee data to Issuables' hook_data
上级
93d62bb8
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
35 addition
and
7 deletion
+35
-7
CHANGELOG
CHANGELOG
+1
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+4
-1
doc/web_hooks/web_hooks.md
doc/web_hooks/web_hooks.md
+20
-6
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+10
-0
未找到文件。
CHANGELOG
浏览文件 @
d146d9fd
...
...
@@ -386,6 +386,7 @@ v 8.1.0
- Improved performance of the trending projects page
- Remove CI migration task
- Improved performance of finding projects by their namespace
- Add assignee data to Issuables' hook_data (Bram Daams)
- Fix bug where transferring a project would result in stale commit links (Stan Hu)
- Fix build trace updating
- Include full path of source and target branch names in New Merge Request page (Stan Hu)
...
...
app/models/concerns/issuable.rb
浏览文件 @
d146d9fd
...
...
@@ -126,7 +126,7 @@ module Issuable
end
def
to_hook_data
(
user
)
{
hook_data
=
{
object_kind:
self
.
class
.
name
.
underscore
,
user:
user
.
hook_attrs
,
repository:
{
...
...
@@ -137,6 +137,9 @@ module Issuable
},
object_attributes:
hook_attrs
}
hook_data
.
merge!
(
assignee:
assignee
.
hook_attrs
)
if
assignee
hook_data
end
def
label_names
...
...
doc/web_hooks/web_hooks.md
浏览文件 @
d146d9fd
...
...
@@ -76,7 +76,6 @@ X-Gitlab-Event: Push Hook
}
],
"total_commits_count"
:
4
}
```
...
...
@@ -158,6 +157,11 @@ X-Gitlab-Event: Issue Hook
"iid"
:
23
,
"url"
:
"http://example.com/diaspora/issues/23"
,
"action"
:
"open"
},
"assignee"
:
{
"name"
:
"User1"
,
"username"
:
"user1"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
}
}
```
...
...
@@ -322,7 +326,12 @@ X-Gitlab-Event: Note Hook
"email"
:
"john@example.com"
}
},
"work_in_progress"
:
false
"work_in_progress"
:
false
,
"assignee"
:
{
"name"
:
"User1"
,
"username"
:
"user1"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
}
}
}
```
...
...
@@ -397,7 +406,7 @@ X-Gitlab-Event: Note Hook
**Request body:**
```
```
json
{
"object_kind"
:
"note"
,
"user"
:
{
...
...
@@ -510,7 +519,12 @@ X-Gitlab-Event: Merge Request Hook
},
"work_in_progress"
:
false
,
"url"
:
"http://example.com/diaspora/merge_requests/1"
,
"action"
:
"open"
"action"
:
"open"
,
"assignee"
:
{
"name"
:
"User1"
,
"username"
:
"user1"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
}
}
}
```
...
...
spec/models/concerns/issuable_spec.rb
浏览文件 @
d146d9fd
...
...
@@ -79,6 +79,16 @@ describe Issue, "Issuable" do
expect
(
hook_data
[
:repository
][
:description
]).
to
eq
(
issue
.
project
.
description
)
expect
(
hook_data
[
:repository
][
:homepage
]).
to
eq
(
issue
.
project
.
web_url
)
expect
(
hook_data
[
:object_attributes
]).
to
eq
(
issue
.
hook_attrs
)
expect
(
hook_data
).
to_not
have_key
(
:assignee
)
end
context
"issue is assigned"
do
before
{
issue
.
update_attribute
(
:assignee
,
user
)
}
it
"returns correct hook data"
do
expect
(
hook_data
[
:object_attributes
][
'assignee_id'
]).
to
eq
(
user
.
id
)
expect
(
hook_data
[
:assignee
]).
to
eq
(
user
.
hook_attrs
)
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录