Merge pull request #28618 from overleaf/jel-commons-enable-while-migrating-to-group

[web] Support Commons migration to a group with domain capture

GitOrigin-RevId: 9262a44fc09d6d19a9c17895ef90bcef877e4a42
This commit is contained in:
Jessica Lawshe
2025-09-23 09:58:43 -05:00
committed by Copybot
parent aef9639405
commit daa4bd9062
2 changed files with 12 additions and 14 deletions

View File

@@ -163,20 +163,18 @@ function getUserAffiliations(userId, callback) {
if (body?.length > 0) {
const concurrencyLimit = 10
await promiseMapWithLimit(concurrencyLimit, body, async affiliation => {
if (!affiliation.institution.commonsAccount) {
const group = (
await Modules.promises.hooks.fire(
'getGroupWithDomainCaptureByV1Id',
affiliation.institution.id
)
)?.[0]
const group = (
await Modules.promises.hooks.fire(
'getGroupWithDomainCaptureByV1Id',
affiliation.institution.id
)
)?.[0]
if (group) {
affiliation.group = {
_id: group._id,
managedUsersEnabled: Boolean(group.managedUsersEnabled),
domainCaptureEnabled: Boolean(group.domainCaptureEnabled),
}
if (group) {
affiliation.group = {
_id: group._id,
managedUsersEnabled: Boolean(group.managedUsersEnabled),
domainCaptureEnabled: Boolean(group.domainCaptureEnabled),
}
}

View File

@@ -145,7 +145,7 @@ describe('InstitutionsAPI', function () {
requestOptions.url.should.equal(expectedUrl)
requestOptions.method.should.equal('GET')
requestOptions.maxAttempts.should.equal(3)
this.Modules.promises.hooks.fire.should.not.have.been.called
this.Modules.promises.hooks.fire.should.have.been.called
expect(requestOptions.body).not.to.exist
expect(body).to.deep.equal(responseBody)
})