Merge pull request #27894 from overleaf/ii-domain-capture-join-button

[web] Domain capture join button

GitOrigin-RevId: aec6033f6776e9384c77fe0ef609c65b13a90f87
This commit is contained in:
Jessica Lawshe
2025-08-19 10:18:44 -05:00
committed by Copybot
parent 1aef3acca9
commit 2389674cca
6 changed files with 24 additions and 15 deletions

View File

@@ -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
}
}
}
}

View File

@@ -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
}
}
}
}

View File

@@ -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

View File

@@ -4,6 +4,7 @@ describe('<DomainCapture />', 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('<DomainCapture />', function () {
})
win.metaAttributesCache.set('ol-email', this.email)
win.metaAttributesCache.set('ol-groupName', this.groupName)
win.metaAttributesCache.set('ol-ssoInitPath', this.ssoInitPath)
})
cy.mount(<DomainCapture />)
@@ -51,7 +53,11 @@ describe('<DomainCapture />', function () {
/get access to enterprise features and benefits provided by your organization/i
)
cy.findByText(/youll 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
)
})
})

View File

@@ -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()

View File

@@ -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()