mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #27894 from overleaf/ii-domain-capture-join-button
[web] Domain capture join button GitOrigin-RevId: aec6033f6776e9384c77fe0ef609c65b13a90f87
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(/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
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user