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
72f8a090
Commit
72f8a090
authored
Aug 07, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include email_opted_in in system hooks user data
parent
ac26518f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
8 deletions
+45
-8
app/services/system_hooks_service.rb
app/services/system_hooks_service.rb
+12
-6
ee/app/services/ee/system_hooks_service.rb
ee/app/services/ee/system_hooks_service.rb
+17
-0
spec/ee/spec/services/ee/system_hooks_service_spec.rb
spec/ee/spec/services/ee/system_hooks_service_spec.rb
+14
-0
spec/services/system_hooks_service_spec.rb
spec/services/system_hooks_service_spec.rb
+2
-2
No files found.
app/services/system_hooks_service.rb
View file @
72f8a090
class
SystemHooksService
prepend
EE
::
SystemHooksService
def
execute_hooks_for
(
model
,
event
)
execute_hooks
(
build_event_data
(
model
,
event
))
end
...
...
@@ -35,12 +37,7 @@ class SystemHooksService
data
[
:old_path_with_namespace
]
=
model
.
old_path_with_namespace
end
when
User
data
.
merge!
({
name:
model
.
name
,
email:
model
.
email
,
user_id:
model
.
id
,
username:
model
.
username
})
data
.
merge!
(
user_data
(
model
))
when
ProjectMember
data
.
merge!
(
project_member_data
(
model
))
when
Group
...
...
@@ -116,4 +113,13 @@ class SystemHooksService
group_access:
model
.
human_access
}
end
def
user_data
(
model
)
{
name:
model
.
name
,
email:
model
.
email
,
user_id:
model
.
id
,
username:
model
.
username
}
end
end
ee/app/services/ee/system_hooks_service.rb
0 → 100644
View file @
72f8a090
module
EE
module
SystemHooksService
# override
private
def
user_data
(
model
)
{
name:
model
.
name
,
email:
model
.
email
,
user_id:
model
.
id
,
username:
model
.
username
,
email_opted_in:
model
.
email_opted_in
}
end
end
end
spec/ee/spec/services/ee/system_hooks_service_spec.rb
0 → 100644
View file @
72f8a090
require
'spec_helper'
describe
EE
::
SystemHooksService
do
let
(
:user
)
{
create
(
:user
)
}
context
'event data'
do
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
)
}
end
def
event_data
(
*
args
)
SystemHooksService
.
new
.
send
:build_event_data
,
*
args
end
end
spec/services/system_hooks_service_spec.rb
View file @
72f8a090
...
...
@@ -10,8 +10,8 @@ describe SystemHooksService do
let
(
:group_member
)
{
create
(
:group_member
)
}
context
'event data'
do
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
)
}
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
)
}
it
{
expect
(
event_data
(
project
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
,
:project_visibility
)
}
it
{
expect
(
event_data
(
project
,
:update
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
,
:project_visibility
)
}
it
{
expect
(
event_data
(
project
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
,
:project_visibility
)
}
...
...
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