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
0e48535a
Commit
0e48535a
authored
Sep 22, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add invitation reminder emails worker implementation
parent
b928a9bd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
app/workers/member_invitation_reminder_emails_worker.rb
app/workers/member_invitation_reminder_emails_worker.rb
+5
-1
spec/workers/member_invitation_reminder_emails_worker_spec.rb
.../workers/member_invitation_reminder_emails_worker_spec.rb
+14
-4
No files found.
app/workers/member_invitation_reminder_emails_worker.rb
View file @
0e48535a
...
...
@@ -10,6 +10,10 @@ class MemberInvitationReminderEmailsWorker # rubocop:disable Scalability/Idempot
def
perform
return
unless
Gitlab
::
Experimentation
.
enabled?
(
:invitation_reminders
)
# To keep this MR small, implementation will be done in another MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42981/diffs?commit_id=8063606e0f83957b2dd38d660ee986f24dee6138
Member
.
not_accepted_invitations
.
not_expired
.
last_ten_days_excluding_today
.
find_in_batches
do
|
invitations
|
invitations
.
each
do
|
invitation
|
Members
::
InvitationReminderEmailService
.
new
(
invitation
).
execute
end
end
end
end
spec/workers/member_invitation_reminder_emails_worker_spec.rb
View file @
0e48535a
...
...
@@ -6,13 +6,19 @@ RSpec.describe MemberInvitationReminderEmailsWorker do
describe
'#perform'
do
subject
{
described_class
.
new
.
perform
}
before
do
create
(
:group_member
,
:invited
,
created_at:
2
.
days
.
ago
)
end
context
'feature flag disabled'
do
before
do
stub_experiment
(
invitation_reminders:
false
)
end
it
'does not raise an error'
do
expect
{
subject
}.
not_to
raise_error
it
'does not attempt to execute the invitation reminder service'
do
expect
(
Members
::
InvitationReminderEmailService
).
not_to
receive
(
:new
)
subject
end
end
...
...
@@ -21,8 +27,12 @@ RSpec.describe MemberInvitationReminderEmailsWorker do
stub_experiment
(
invitation_reminders:
true
)
end
it
'does not raise an error'
do
expect
{
subject
}.
not_to
raise_error
it
'executes the invitation reminder email service'
do
expect_next_instance_of
(
Members
::
InvitationReminderEmailService
)
do
|
service
|
expect
(
service
).
to
receive
(
:execute
)
end
subject
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