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:
committed by
Copybot
parent
cb5430f8b5
commit
42b5f91b9f
@@ -80,7 +80,9 @@ async function acceptInvite(token, userId) {
|
||||
)
|
||||
}
|
||||
if (subscription.ssoConfig) {
|
||||
const ssoConfig = await SSOConfig.findById(subscription.ssoConfig)
|
||||
const ssoConfig = await SSOConfig.findById(
|
||||
subscription.ssoConfig._id || subscription.ssoConfig
|
||||
)
|
||||
if (ssoConfig?.enabled) {
|
||||
await Modules.promises.hooks.fire(
|
||||
'scheduleGroupSSOReminder',
|
||||
@@ -153,6 +155,26 @@ async function _createInvite(subscription, email, inviter) {
|
||||
// legacy: remove any invite that might have been created in the past
|
||||
await _removeInviteFromTeam(subscription._id, email)
|
||||
|
||||
try {
|
||||
if (subscription.ssoConfig) {
|
||||
const ssoConfig = await SSOConfig.findById(
|
||||
subscription.ssoConfig._id || subscription.ssoConfig
|
||||
)
|
||||
if (ssoConfig?.enabled) {
|
||||
await Modules.promises.hooks.fire(
|
||||
'sendGroupSSOReminder',
|
||||
inviter._id,
|
||||
subscription._id
|
||||
)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
{ err: error, userId: inviter._id, subscriptionId: subscription._id },
|
||||
'Failed to schedule Group SSO invite for group admin'
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
email: inviter.email,
|
||||
first_name: inviter.first_name,
|
||||
|
||||
Reference in New Issue
Block a user