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
f312e66d
Commit
f312e66d
authored
Mar 26, 2021
by
Nicolas Dular
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of current_batch_user_ids
parent
c2b3d1b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
app/services/namespaces/in_product_marketing_emails_service.rb
...ervices/namespaces/in_product_marketing_emails_service.rb
+9
-11
No files found.
app/services/namespaces/in_product_marketing_emails_service.rb
View file @
f312e66d
...
...
@@ -23,7 +23,6 @@ module Namespaces
def
initialize
(
track
,
interval
)
@track
=
track
@interval
=
interval
@current_batch_user_ids
=
[]
@in_product_marketing_email_records
=
[]
end
...
...
@@ -35,13 +34,11 @@ module Namespaces
send_email_for_group
(
group
)
end
end
record_sent_emails
end
private
attr_reader
:track
,
:interval
,
:
current_batch_user_ids
,
:
in_product_marketing_email_records
attr_reader
:track
,
:interval
,
:in_product_marketing_email_records
def
send_email_for_group
(
group
)
experiment_enabled_for_group
=
experiment_enabled_for_group?
(
group
)
...
...
@@ -49,10 +46,15 @@ module Namespaces
return
unless
experiment_enabled_for_group
users_for_group
(
group
).
each
do
|
user
|
send_email
(
user
,
group
)
if
can_perform_action?
(
user
,
group
)
if
can_perform_action?
(
user
,
group
)
send_email
(
user
,
group
)
track_sent_email
(
user
,
track
,
series
)
end
end
save_tracked_emails!
end
def
experiment_enabled_for_group?
(
group
)
Gitlab
::
Experimentation
.
in_experiment_group?
(
:in_product_marketing_emails
,
subject:
group
)
end
...
...
@@ -77,7 +79,6 @@ module Namespaces
def
users_for_group
(
group
)
group
.
users
.
where
(
email_opted_in:
true
)
.
where
.
not
(
id:
current_batch_user_ids
)
.
merge
(
Users
::
InProductMarketingEmail
.
without_track_and_series
(
track
,
series
))
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
@@ -97,8 +98,6 @@ module Namespaces
def
send_email
(
user
,
group
)
NotificationService
.
new
.
in_product_marketing
(
user
.
id
,
group
.
id
,
track
,
series
)
track_sent_email
(
user
,
track
,
series
)
end
def
completed_actions
...
...
@@ -119,13 +118,12 @@ module Namespaces
INTERVAL_DAYS
.
index
(
interval
)
end
def
record_sent_emails
def
save_tracked_emails!
Users
::
InProductMarketingEmail
.
bulk_insert!
(
in_product_marketing_email_records
)
@in_product_marketing_email_records
=
[]
end
def
track_sent_email
(
user
,
track
,
series
)
current_batch_user_ids
<<
user
.
id
in_product_marketing_email_records
<<
Users
::
InProductMarketingEmail
.
new
(
user:
user
,
track:
track
,
...
...
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