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
cc92b94a
Commit
cc92b94a
authored
Sep 21, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Member#send_invitation_reminder method
For use in the invitation reminder emails worker
parent
58f318e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
app/models/member.rb
app/models/member.rb
+8
-0
spec/models/member_spec.rb
spec/models/member_spec.rb
+39
-0
No files found.
app/models/member.rb
View file @
cc92b94a
...
...
@@ -370,6 +370,14 @@ class Member < ApplicationRecord
send_invite
end
def
send_invitation_reminder
(
reminder_index
)
return
unless
invite?
generate_invite_token!
unless
@raw_invite_token
run_after_commit_or_now
{
notification_service
.
invite_member_reminder
(
self
,
@raw_invite_token
,
reminder_index
)
}
end
def
create_notification_setting
user
.
notification_settings
.
find_or_create_for
(
source
)
end
...
...
spec/models/member_spec.rb
View file @
cc92b94a
...
...
@@ -676,6 +676,45 @@ RSpec.describe Member do
end
end
describe
'#send_invitation_reminder'
do
subject
{
member
.
send_invitation_reminder
(
0
)
}
context
'an invited group member'
do
let!
(
:member
)
{
create
(
:group_member
,
:invited
)
}
it
'sends a reminder'
do
expect_any_instance_of
(
NotificationService
).
to
receive
(
:invite_member_reminder
).
with
(
member
,
member
.
raw_invite_token
,
0
)
subject
end
end
context
'an invited member without a raw invite token set'
do
let!
(
:member
)
{
create
(
:group_member
,
:invited
)
}
before
do
member
.
instance_variable_set
(
:@raw_invite_token
,
nil
)
allow_any_instance_of
(
NotificationService
).
to
receive
(
:invite_member_reminder
)
end
it
'generates a new token'
do
expect
(
member
).
to
receive
(
:generate_invite_token!
)
subject
end
end
context
'an uninvited member'
do
let!
(
:member
)
{
create
(
:group_member
)
}
it
'does not send a reminder'
do
expect_any_instance_of
(
NotificationService
).
not_to
receive
(
:invite_member_reminder
)
subject
end
end
end
describe
"#invite_to_unknown_user?"
do
subject
{
member
.
invite_to_unknown_user?
}
...
...
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