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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d146d9fd
Commit
d146d9fd
authored
Oct 18, 2015
by
Bram Daams
Committed by
Rémy Coutable
Feb 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add assignee data to Issuables' hook_data
parent
93d62bb8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
7 deletions
+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
No files found.
CHANGELOG
View file @
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
View file @
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
View file @
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
View file @
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
...
...
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