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
172f253a
Commit
172f253a
authored
Aug 08, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include all email opt-in data for marketo
parent
1012b1c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
ee/app/services/ee/system_hooks_service.rb
ee/app/services/ee/system_hooks_service.rb
+14
-3
spec/ee/spec/services/ee/system_hooks_service_spec.rb
spec/ee/spec/services/ee/system_hooks_service_spec.rb
+17
-2
No files found.
ee/app/services/ee/system_hooks_service.rb
View file @
172f253a
...
...
@@ -5,12 +5,23 @@ module EE
private
def
user_data
(
model
)
{
data
=
{
name:
model
.
name
,
email:
model
.
email
,
user_id:
model
.
id
,
username:
model
.
username
,
email_opted_in:
model
.
email_opted_in
username:
model
.
username
}
data
.
merge!
(
email_opted_in_data
(
model
))
if
::
Gitlab
.
com?
data
end
def
email_opted_in_data
(
model
)
{
email_opted_in:
model
.
email_opted_in
,
email_opted_in_ip:
model
.
email_opted_in_ip
,
email_opted_in_source:
model
.
email_opted_in_source
,
email_opted_in_at:
model
.
email_opted_in_at
,
}
end
end
...
...
spec/ee/spec/services/ee/system_hooks_service_spec.rb
View file @
172f253a
...
...
@@ -4,8 +4,23 @@ 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
)
}
context
'for GitLab.com'
do
before
do
expect
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
,
:email_opted_in_ip
,
:email_opted_in_source
,
:email_opted_in_at
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
,
:email_opted_in_ip
,
:email_opted_in_source
,
:email_opted_in_at
)
}
end
context
'for non-GitLab.com'
do
before
do
expect
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
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
)
}
end
end
def
event_data
(
*
args
)
...
...
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