Merge pull request #17153 from overleaf/ab-send-group-sso-invite-self

[web] Send the SSO linking invite when the group admin is adding self to the group

GitOrigin-RevId: f87ce6cfb006a0e353394e4102881e6220e5e6d9
This commit is contained in:
Alexandre Bourdin
2024-02-19 09:03:22 +00:00
committed by Copybot
parent cb5430f8b5
commit 42b5f91b9f
2 changed files with 62 additions and 1 deletions
@@ -259,6 +259,45 @@ describe('TeamInvitesHandler', function () {
)
})
it('sends an SSO invite if SSO is enabled and inviting self', function (done) {
this.subscription.ssoConfig = new ObjectId('abc123abc123')
this.SSOConfig.findById
.withArgs(this.subscription.ssoConfig)
.resolves({ enabled: true })
this.TeamInvitesHandler.createInvite(
this.manager._id,
this.subscription,
this.manager.email,
(err, invite) => {
sinon.assert.calledWith(
this.Modules.promises.hooks.fire,
'sendGroupSSOReminder',
this.manager._id,
this.subscription._id
)
done(err)
}
)
})
it('does not send an SSO invite if SSO is disabled and inviting self', function (done) {
this.subscription.ssoConfig = new ObjectId('abc123abc123')
this.SSOConfig.findById
.withArgs(this.subscription.ssoConfig)
.resolves({ enabled: false })
this.TeamInvitesHandler.createInvite(
this.manager._id,
this.subscription,
this.manager.email,
(err, invite) => {
sinon.assert.notCalled(this.Modules.promises.hooks.fire)
done(err)
}
)
})
it('sends a notification if inviting registered user', function (done) {
const id = new ObjectId('6a6b3a8014829a865bbf700d')
const managedUsersEnabled = false