From 2389674cca9d754638b68aeb6ea7deadb4fec7f8 Mon Sep 17 00:00:00 2001
From: Jessica Lawshe <5312836+lawshe@users.noreply.github.com>
Date: Tue, 19 Aug 2025 10:18:44 -0500
Subject: [PATCH] Merge pull request #27894 from
overleaf/ii-domain-capture-join-button
[web] Domain capture join button
GitOrigin-RevId: aec6033f6776e9384c77fe0ef609c65b13a90f87
---
.../web/app/src/Features/Project/ProjectController.js | 8 ++++++--
.../app/src/Features/Project/ProjectListController.mjs | 8 ++++++--
services/web/frontend/js/utils/meta.ts | 1 +
.../group-management/components/domain-capture.spec.tsx | 8 +++++++-
.../web/test/unit/src/Project/ProjectControllerTests.js | 7 ++-----
.../test/unit/src/Project/ProjectListController.test.mjs | 7 ++-----
6 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js
index 9b5c9ad2ed..ea61c76fdf 100644
--- a/services/web/app/src/Features/Project/ProjectController.js
+++ b/services/web/app/src/Features/Project/ProjectController.js
@@ -333,13 +333,17 @@ const _ProjectController = {
if (domainCaptureRedirect === 'enabled') {
const subscription = (
await Modules.promises.hooks.fire(
- 'findDomainCaptureAndManagedUsersGroupUserShouldBePartOf',
+ 'findDomainCaptureGroupUserCouldBePartOf',
userId
)
)?.[0]
if (subscription) {
- return res.redirect('/domain-capture')
+ if (subscription.managedUsersEnabled) {
+ return res.redirect('/domain-capture')
+ } else {
+ // TODO show notification or anything else
+ }
}
}
}
diff --git a/services/web/app/src/Features/Project/ProjectListController.mjs b/services/web/app/src/Features/Project/ProjectListController.mjs
index 712168f912..b758bba050 100644
--- a/services/web/app/src/Features/Project/ProjectListController.mjs
+++ b/services/web/app/src/Features/Project/ProjectListController.mjs
@@ -124,13 +124,17 @@ async function projectListPage(req, res, next) {
if (domainCaptureRedirect === 'enabled') {
const subscription = (
await Modules.promises.hooks.fire(
- 'findDomainCaptureAndManagedUsersGroupUserShouldBePartOf',
+ 'findDomainCaptureGroupUserCouldBePartOf',
userId
)
)?.[0]
if (subscription) {
- return res.redirect('/domain-capture')
+ if (subscription.managedUsersEnabled) {
+ return res.redirect('/domain-capture')
+ } else {
+ // TODO show notification or anything else
+ }
}
}
}
diff --git a/services/web/frontend/js/utils/meta.ts b/services/web/frontend/js/utils/meta.ts
index 46299a5dc1..162ed749f1 100644
--- a/services/web/frontend/js/utils/meta.ts
+++ b/services/web/frontend/js/utils/meta.ts
@@ -255,6 +255,7 @@ export interface Meta {
'ol-splitTestVariants': { [name: string]: string }
'ol-ssoDisabled': boolean
'ol-ssoErrorMessage': string
+ 'ol-ssoInitPath': string
'ol-stripeAccountId': string
'ol-stripeSubscriptionData': {
customerId: string
diff --git a/services/web/test/frontend/features/group-management/components/domain-capture.spec.tsx b/services/web/test/frontend/features/group-management/components/domain-capture.spec.tsx
index db89129106..e38134c712 100644
--- a/services/web/test/frontend/features/group-management/components/domain-capture.spec.tsx
+++ b/services/web/test/frontend/features/group-management/components/domain-capture.spec.tsx
@@ -4,6 +4,7 @@ describe('', function () {
beforeEach(function () {
this.email = 'user@example.com'
this.groupName = 'test-group'
+ this.ssoInitPath = '/sso/init/path'
cy.window().then(win => {
win.metaAttributesCache.set('ol-user', {
@@ -13,6 +14,7 @@ describe('', function () {
})
win.metaAttributesCache.set('ol-email', this.email)
win.metaAttributesCache.set('ol-groupName', this.groupName)
+ win.metaAttributesCache.set('ol-ssoInitPath', this.ssoInitPath)
})
cy.mount()
@@ -51,7 +53,11 @@ describe('', function () {
/get access to enterprise features and benefits provided by your organization/i
)
cy.findByText(/you’ll continue to have access to all of your projects/i)
- cy.findByRole('button', { name: /join/i })
+ cy.findByRole('link', { name: /join/i }).should(
+ 'have.attr',
+ 'href',
+ this.ssoInitPath
+ )
})
})
diff --git a/services/web/test/unit/src/Project/ProjectControllerTests.js b/services/web/test/unit/src/Project/ProjectControllerTests.js
index 2c2f95bfd3..02a75b213a 100644
--- a/services/web/test/unit/src/Project/ProjectControllerTests.js
+++ b/services/web/test/unit/src/Project/ProjectControllerTests.js
@@ -600,11 +600,8 @@ describe('ProjectController', function () {
.withArgs(this.req, this.res, 'domain-capture-redirect')
.resolves({ variant: 'enabled' })
this.Modules.promises.hooks.fire
- .withArgs(
- 'findDomainCaptureAndManagedUsersGroupUserShouldBePartOf',
- this.user._id
- )
- .resolves([{ _id: new ObjectId() }])
+ .withArgs('findDomainCaptureGroupUserCouldBePartOf', this.user._id)
+ .resolves([{ _id: new ObjectId(), managedUsersEnabled: true }])
this.res.redirect = url => {
url.should.equal('/domain-capture')
done()
diff --git a/services/web/test/unit/src/Project/ProjectListController.test.mjs b/services/web/test/unit/src/Project/ProjectListController.test.mjs
index 57ccb5887a..70dd4a6658 100644
--- a/services/web/test/unit/src/Project/ProjectListController.test.mjs
+++ b/services/web/test/unit/src/Project/ProjectListController.test.mjs
@@ -500,11 +500,8 @@ describe('ProjectListController', function () {
.withArgs(ctx.req, ctx.res, 'domain-capture-redirect')
.resolves({ variant: 'enabled' })
ctx.Modules.promises.hooks.fire
- .withArgs(
- 'findDomainCaptureAndManagedUsersGroupUserShouldBePartOf',
- ctx.user._id
- )
- .resolves([{ _id: new ObjectId() }])
+ .withArgs('findDomainCaptureGroupUserCouldBePartOf', ctx.user._id)
+ .resolves([{ _id: new ObjectId(), managedUsersEnabled: true }])
ctx.res.redirect = url => {
url.should.equal('/domain-capture')
resolve()