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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
e4ac2d58
Commit
e4ac2d58
authored
Sep 11, 2015
by
Jungkook Park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add repository field to issue hook data
add a test for to_hook_data of issue model update CHANGELOG
parent
cac96922
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 @
e4ac2d58
...
@@ -50,6 +50,7 @@ v 8.0.0 (unreleased)
...
@@ -50,6 +50,7 @@ v 8.0.0 (unreleased)
- Added service API endpoint to retrieve service parameters (Petheő Bence)
- Added service API endpoint to retrieve service parameters (Petheő Bence)
- Add FogBugz project import (Jared Szechy)
- Add FogBugz project import (Jared Szechy)
- Sort users autocomplete lists by user (Allister Antosik)
- Sort users autocomplete lists by user (Allister Antosik)
- Webhook for issue now contains repository field (Jungkook Park)
v 7.14.3
v 7.14.3
- No changes
- No changes
...
...
app/models/concerns/issuable.rb
View file @
e4ac2d58
...
@@ -140,6 +140,12 @@ module Issuable
...
@@ -140,6 +140,12 @@ module Issuable
{
{
object_kind:
self
.
class
.
name
.
underscore
,
object_kind:
self
.
class
.
name
.
underscore
,
user:
user
.
hook_attrs
,
user:
user
.
hook_attrs
,
repository:
{
name:
project
.
name
,
url:
project
.
url_to_repo
,
description:
project
.
description
,
homepage:
project
.
web_url
},
object_attributes:
hook_attrs
object_attributes:
hook_attrs
}
}
end
end
...
...
doc/web_hooks/web_hooks.md
View file @
e4ac2d58
...
@@ -121,6 +121,12 @@ X-Gitlab-Event: Issue Hook
...
@@ -121,6 +121,12 @@ X-Gitlab-Event: Issue Hook
"username"
:
"root"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"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"
:
{
"object_attributes"
:
{
"id"
:
301
,
"id"
:
301
,
"title"
:
"New API: create/update/delete file"
,
"title"
:
"New API: create/update/delete file"
,
...
...
spec/models/concerns/issuable_spec.rb
View file @
e4ac2d58
...
@@ -2,6 +2,7 @@ require 'spec_helper'
...
@@ -2,6 +2,7 @@ require 'spec_helper'
describe
Issue
,
"Issuable"
do
describe
Issue
,
"Issuable"
do
let
(
:issue
)
{
create
(
:issue
)
}
let
(
:issue
)
{
create
(
:issue
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
"Associations"
do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
belong_to
(
:project
)
}
...
@@ -66,4 +67,19 @@ describe Issue, "Issuable" do
...
@@ -66,4 +67,19 @@ describe Issue, "Issuable" do
expect
(
issue
.
new?
).
to
be_falsey
expect
(
issue
.
new?
).
to
be_falsey
end
end
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
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