mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-13 21:53:43 +01:00
Merge pull request #27834 from overleaf/ii-domain-capture-not-in-group-redirect
[web] Redirect to domain capture page GitOrigin-RevId: 15d2b8046beb5a40fc4937c337ee9655abaed8fd
This commit is contained in:
@@ -173,6 +173,8 @@ function getUserAffiliations(userId, callback) {
|
||||
|
||||
if (group) {
|
||||
affiliation.group = {
|
||||
_id: group._id,
|
||||
managedUsersEnabled: Boolean(group.managedUsersEnabled),
|
||||
domainCaptureEnabled: Boolean(group.domainCaptureEnabled),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +322,28 @@ const _ProjectController = {
|
||||
userId = null
|
||||
}
|
||||
|
||||
if (Features.hasFeature('saas') && userId) {
|
||||
const { variant: domainCaptureRedirect } =
|
||||
await SplitTestHandler.promises.getAssignment(
|
||||
req,
|
||||
res,
|
||||
'domain-capture-redirect'
|
||||
)
|
||||
|
||||
if (domainCaptureRedirect === 'enabled') {
|
||||
const subscription = (
|
||||
await Modules.promises.hooks.fire(
|
||||
'findDomainCaptureAndManagedUsersGroupUserShouldBePartOf',
|
||||
userId
|
||||
)
|
||||
)?.[0]
|
||||
|
||||
if (subscription) {
|
||||
return res.redirect('/domain-capture')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const projectId = req.params.Project_id
|
||||
|
||||
// should not be used in place of split tests query param overrides (?my-split-test-name=my-variant)
|
||||
|
||||
@@ -112,6 +112,29 @@ async function projectListPage(req, res, next) {
|
||||
const isSaas = Features.hasFeature('saas')
|
||||
|
||||
const userId = SessionManager.getLoggedInUserId(req.session)
|
||||
|
||||
if (isSaas) {
|
||||
const { variant: domainCaptureRedirect } =
|
||||
await SplitTestHandler.promises.getAssignment(
|
||||
req,
|
||||
res,
|
||||
'domain-capture-redirect'
|
||||
)
|
||||
|
||||
if (domainCaptureRedirect === 'enabled') {
|
||||
const subscription = (
|
||||
await Modules.promises.hooks.fire(
|
||||
'findDomainCaptureAndManagedUsersGroupUserShouldBePartOf',
|
||||
userId
|
||||
)
|
||||
)?.[0]
|
||||
|
||||
if (subscription) {
|
||||
return res.redirect('/domain-capture')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const projectsBlobPending = _getProjects(userId).catch(err => {
|
||||
logger.err({ err, userId }, 'projects listing in background failed')
|
||||
return undefined
|
||||
|
||||
@@ -325,6 +325,7 @@ const decorateFullEmails = (
|
||||
past_reconfirm_date: cachedPastReconfirmDate,
|
||||
entitlement: cachedEntitlement,
|
||||
portal,
|
||||
group,
|
||||
} = affiliation
|
||||
const lastDayToReconfirm = _lastDayToReconfirm(emailData, institution)
|
||||
let { last_day_to_reconfirm: cachedLastDayToReconfirm } = affiliation
|
||||
@@ -353,6 +354,9 @@ const decorateFullEmails = (
|
||||
licence,
|
||||
portal,
|
||||
}
|
||||
if (group) {
|
||||
emailData.affiliation.group = group
|
||||
}
|
||||
}
|
||||
|
||||
if (emailData.samlProviderId) {
|
||||
|
||||
Reference in New Issue
Block a user