Преглед изворни кода

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
Jessica Lawshe пре 10 месеци
родитељ
комит
daa4bd9062

+ 12 - 14
services/web/app/src/Features/Institutions/InstitutionsAPI.js

@@ -163,20 +163,18 @@ function getUserAffiliations(userId, callback) {
       if (body?.length > 0) {
       if (body?.length > 0) {
         const concurrencyLimit = 10
         const concurrencyLimit = 10
         await promiseMapWithLimit(concurrencyLimit, body, async affiliation => {
         await promiseMapWithLimit(concurrencyLimit, body, async affiliation => {
-          if (!affiliation.institution.commonsAccount) {
-            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),
-              }
+          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),
             }
             }
           }
           }
 
 

+ 1 - 1
services/web/test/unit/src/Institutions/InstitutionsAPITests.js

@@ -145,7 +145,7 @@ describe('InstitutionsAPI', function () {
       requestOptions.url.should.equal(expectedUrl)
       requestOptions.url.should.equal(expectedUrl)
       requestOptions.method.should.equal('GET')
       requestOptions.method.should.equal('GET')
       requestOptions.maxAttempts.should.equal(3)
       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(requestOptions.body).not.to.exist
       expect(body).to.deep.equal(responseBody)
       expect(body).to.deep.equal(responseBody)
     })
     })