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
b75e4d71
Commit
b75e4d71
authored
Sep 17, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9618 from pjknkda/repo-info-to-issue-hook
add repository field to issue hook data
parents
3c2a6174
e4ac2d58
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
+29
-0
CHANGELOG
CHANGELOG
+1
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+6
-0
doc/web_hooks/web_hooks.md
doc/web_hooks/web_hooks.md
+6
-0
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+16
-0
No files found.
CHANGELOG
View file @
b75e4d71
...
...
@@ -52,6 +52,7 @@ v 8.0.0 (unreleased)
- Added service API endpoint to retrieve service parameters (Petheő Bence)
- Add FogBugz project import (Jared Szechy)
- Sort users autocomplete lists by user (Allister Antosik)
- Webhook for issue now contains repository field (Jungkook Park)
v 7.14.3
- No changes
...
...
app/models/concerns/issuable.rb
View file @
b75e4d71
...
...
@@ -140,6 +140,12 @@ module Issuable
{
object_kind:
self
.
class
.
name
.
underscore
,
user:
user
.
hook_attrs
,
repository:
{
name:
project
.
name
,
url:
project
.
url_to_repo
,
description:
project
.
description
,
homepage:
project
.
web_url
},
object_attributes:
hook_attrs
}
end
...
...
doc/web_hooks/web_hooks.md
View file @
b75e4d71
...
...
@@ -121,6 +121,12 @@ X-Gitlab-Event: Issue Hook
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
},
"repository"
:
{
"name"
:
"Gitlab Test"
,
"url"
:
"http://example.com/gitlabhq/gitlab-test.git"
,
"description"
:
"Aut reprehenderit ut est."
,
"homepage"
:
"http://example.com/gitlabhq/gitlab-test"
},
"object_attributes"
:
{
"id"
:
301
,
"title"
:
"New API: create/update/delete file"
,
...
...
spec/models/concerns/issuable_spec.rb
View file @
b75e4d71
...
...
@@ -2,6 +2,7 @@ require 'spec_helper'
describe
Issue
,
"Issuable"
do
let
(
:issue
)
{
create
(
:issue
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
...
...
@@ -66,4 +67,19 @@ describe Issue, "Issuable" do
expect
(
issue
.
new?
).
to
be_falsey
end
end
describe
"#to_hook_data"
do
let
(
:hook_data
)
{
issue
.
to_hook_data
(
user
)
}
it
"returns correct hook data"
do
expect
(
hook_data
[
:object_kind
]).
to
eq
(
"issue"
)
expect
(
hook_data
[
:user
]).
to
eq
(
user
.
hook_attrs
)
expect
(
hook_data
[
:repository
][
:name
]).
to
eq
(
issue
.
project
.
name
)
expect
(
hook_data
[
:repository
][
:url
]).
to
eq
(
issue
.
project
.
url_to_repo
)
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
)
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