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
Jérome Perrin
gitlab-ce
Commits
11848feb
Commit
11848feb
authored
Oct 05, 2014
by
Kirill Zaitsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add issueable actor
parent
43be3fcb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
4 deletions
+25
-4
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-1
app/models/user.rb
app/models/user.rb
+8
-0
app/services/issues/base_service.rb
app/services/issues/base_service.rb
+1
-1
app/services/merge_requests/base_merge_service.rb
app/services/merge_requests/base_merge_service.rb
+2
-1
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+2
-1
doc/web_hooks/web_hooks.md
doc/web_hooks/web_hooks.md
+10
-0
No files found.
app/models/concerns/issuable.rb
View file @
11848feb
...
...
@@ -131,9 +131,10 @@ module Issuable
users
.
concat
(
mentions
.
reduce
([],
:|
)).
uniq
end
def
to_hook_data
def
to_hook_data
(
user
)
{
object_kind:
self
.
class
.
name
.
underscore
,
user:
user
.
hook_attrs
,
object_attributes:
hook_attrs
}
end
...
...
app/models/user.rb
View file @
11848feb
...
...
@@ -488,6 +488,14 @@ class User < ActiveRecord::Base
end
end
def
hook_attrs
{
name:
name
,
username:
username
,
avatar_url:
avatar_url
}
end
def
ensure_namespace_correct
# Ensure user has namespace
self
.
create_namespace!
(
path:
self
.
username
,
name:
self
.
username
)
unless
self
.
namespace
...
...
app/services/issues/base_service.rb
View file @
11848feb
...
...
@@ -8,7 +8,7 @@ module Issues
end
def
execute_hooks
(
issue
,
action
=
'open'
)
issue_data
=
issue
.
to_hook_data
issue_data
=
issue
.
to_hook_data
(
current_user
)
issue_url
=
Gitlab
::
UrlBuilder
.
new
(
:issue
).
build
(
issue
.
id
)
issue_data
[
:object_attributes
].
merge!
(
url:
issue_url
,
action:
action
)
issue
.
project
.
execute_hooks
(
issue_data
,
:issue_hooks
)
...
...
app/services/merge_requests/base_merge_service.rb
View file @
11848feb
...
...
@@ -13,7 +13,8 @@ module MergeRequests
def
execute_project_hooks
(
merge_request
)
if
merge_request
.
project
merge_request
.
project
.
execute_hooks
(
merge_request
.
to_hook_data
,
:merge_request_hooks
)
hook_data
=
merge_request
.
to_hook_data
(
current_user
)
merge_request
.
project
.
execute_hooks
(
hook_data
,
:merge_request_hooks
)
end
end
end
...
...
app/services/merge_requests/base_service.rb
View file @
11848feb
...
...
@@ -13,7 +13,8 @@ module MergeRequests
def
execute_hooks
(
merge_request
)
if
merge_request
.
project
merge_request
.
project
.
execute_hooks
(
merge_request
.
to_hook_data
,
:merge_request_hooks
)
hook_data
=
merge_request
.
to_hook_data
(
current_user
)
merge_request
.
project
.
execute_hooks
(
hook_data
,
:merge_request_hooks
)
end
end
...
...
doc/web_hooks/web_hooks.md
View file @
11848feb
...
...
@@ -63,6 +63,11 @@ Triggered when a new issue is created or an existing issue was updated/closed/re
```
json
{
"object_kind"
:
"issue"
,
"user"
:
{
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
},
"object_attributes"
:
{
"id"
:
301
,
"title"
:
"New API: create/update/delete file"
,
...
...
@@ -92,6 +97,11 @@ Triggered when a new merge request is created or an existing merge request was u
```
json
{
"object_kind"
:
"merge_request"
,
"user"
:
{
"name"
:
"Administrator"
,
"username"
:
"root"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
},
"object_attributes"
:
{
"id"
:
99
,
"target_branch"
:
"master"
,
...
...
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