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
Tatuya Kamada
gitlab-ce
Commits
c147b571
Commit
c147b571
authored
Oct 08, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/system_hook_user_id' of /home/git/repositories/gitlab/gitlabhq
parents
5cf31b92
9a032901
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
31 deletions
+26
-31
app/services/system_hooks_service.rb
app/services/system_hooks_service.rb
+2
-1
app/views/admin/hooks/_data_ex.html.erb
app/views/admin/hooks/_data_ex.html.erb
+4
-2
spec/services/system_hooks_service_spec.rb
spec/services/system_hooks_service_spec.rb
+20
-28
No files found.
app/services/system_hooks_service.rb
View file @
c147b571
...
@@ -36,7 +36,8 @@ class SystemHooksService
...
@@ -36,7 +36,8 @@ class SystemHooksService
when
User
when
User
data
.
merge!
({
data
.
merge!
({
name:
model
.
name
,
name:
model
.
name
,
email:
model
.
email
email:
model
.
email
,
user_id:
model
.
id
})
})
when
UsersProject
when
UsersProject
data
.
merge!
({
data
.
merge!
({
...
...
app/views/admin/hooks/_data_ex.html.erb
View file @
c147b571
...
@@ -52,7 +52,8 @@
...
@@ -52,7 +52,8 @@
"created_at": "2012-07-21T07:44:07Z",
"created_at": "2012-07-21T07:44:07Z",
"email": "js@gitlabhq.com",
"email": "js@gitlabhq.com",
"event_name": "user_create",
"event_name": "user_create",
"name": "John Smith"
"name": "John Smith",
"user_id": 41
}
}
6. User removed:
6. User removed:
...
@@ -60,7 +61,8 @@
...
@@ -60,7 +61,8 @@
"created_at": "2012-07-21T07:44:07Z",
"created_at": "2012-07-21T07:44:07Z",
"email": "js@gitlabhq.com",
"email": "js@gitlabhq.com",
"event_name": "user_destroy",
"event_name": "user_destroy",
"name": "John Smith"
"name": "John Smith",
"user_id": 41
}
}
eos
eos
...
...
spec/services/system_hooks_service_spec.rb
View file @
c147b571
...
@@ -5,37 +5,29 @@ describe SystemHooksService do
...
@@ -5,37 +5,29 @@ describe SystemHooksService do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
:project
}
let
(
:users_project
)
{
create
:users_project
}
let
(
:users_project
)
{
create
:users_project
}
context
'it should build event data'
do
context
'event data'
do
it
'should build event data for user'
do
it
{
event_data
(
user
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:email
,
:user_id
)
}
SystemHooksService
.
build_event_data
(
user
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:email
)
it
{
event_data
(
user
,
:destroy
).
should
include
(
:event_name
,
:name
,
:created_at
,
:email
,
:user_id
)
}
end
it
{
event_data
(
project
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
)
}
it
{
event_data
(
project
,
:destroy
).
should
include
(
:event_name
,
:name
,
:created_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
)
}
it
'should build event data for project'
do
it
{
event_data
(
users_project
,
:create
).
should
include
(
:event_name
,
:created_at
,
:project_name
,
:project_path
,
:project_id
,
:user_name
,
:user_email
,
:project_access
)
}
SystemHooksService
.
build_event_data
(
project
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
)
it
{
event_data
(
users_project
,
:destroy
).
should
include
(
:event_name
,
:created_at
,
:project_name
,
:project_path
,
:project_id
,
:user_name
,
:user_email
,
:project_access
)
}
end
it
'should build event data for users project'
do
SystemHooksService
.
build_event_data
(
users_project
,
:create
).
should
include
(
:event_name
,
:created_at
,
:project_name
,
:project_path
,
:project_id
,
:user_name
,
:user_email
,
:project_access
)
end
end
end
context
'it should build event names'
do
context
'event names'
do
it
'should build event names for user'
do
it
{
event_name
(
user
,
:create
).
should
eq
"user_create"
}
SystemHooksService
.
build_event_name
(
user
,
:create
).
should
eq
"user_create"
it
{
event_name
(
user
,
:destroy
).
should
eq
"user_destroy"
}
it
{
event_name
(
project
,
:create
).
should
eq
"project_create"
}
SystemHooksService
.
build_event_name
(
user
,
:destroy
).
should
eq
"user_destroy"
it
{
event_name
(
project
,
:destroy
).
should
eq
"project_destroy"
}
end
it
{
event_name
(
users_project
,
:create
).
should
eq
"user_add_to_team"
}
it
{
event_name
(
users_project
,
:destroy
).
should
eq
"user_remove_from_team"
}
it
'should build event names for project'
do
end
SystemHooksService
.
build_event_name
(
project
,
:create
).
should
eq
"project_create"
SystemHooksService
.
build_event_name
(
project
,
:destroy
).
should
eq
"project_destroy"
end
it
'should build event names for users project'
do
def
event_data
(
*
args
)
SystemHooksService
.
build_event_name
(
users_project
,
:create
).
should
eq
"user_add_to_team"
SystemHooksService
.
build_event_data
(
*
args
)
end
SystemHooksService
.
build_event_name
(
users_project
,
:destroy
).
should
eq
"user_remove_from_team"
def
event_name
(
*
args
)
end
SystemHooksService
.
build_event_name
(
*
args
)
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