From daa4bd90624f58ae9bad746edb7134939e142edb Mon Sep 17 00:00:00 2001 From: Jessica Lawshe <5312836+lawshe@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:58:43 -0500 Subject: [PATCH] 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 --- .../Features/Institutions/InstitutionsAPI.js | 24 +++++++++---------- .../src/Institutions/InstitutionsAPITests.js | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/services/web/app/src/Features/Institutions/InstitutionsAPI.js b/services/web/app/src/Features/Institutions/InstitutionsAPI.js index 3276cb347d..3db0a470da 100644 --- a/services/web/app/src/Features/Institutions/InstitutionsAPI.js +++ b/services/web/app/src/Features/Institutions/InstitutionsAPI.js @@ -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), } } diff --git a/services/web/test/unit/src/Institutions/InstitutionsAPITests.js b/services/web/test/unit/src/Institutions/InstitutionsAPITests.js index c76f4f9a2f..f4702f3bde 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsAPITests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsAPITests.js @@ -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) })