From b5625fe3df33563bddd161b16ba17711f2fdd8f5 Mon Sep 17 00:00:00 2001 From: June Kelly Date: Wed, 12 Jan 2022 09:53:41 +0000 Subject: [PATCH] Merge pull request #6227 from overleaf/jpa-de-dupe-feature-refresh [web] when confirming institution domain, refresh features once per user GitOrigin-RevId: 3855441848cf0b140a6cf0264b887d8eca7db5ad --- .../Institutions/InstitutionsController.js | 17 +++++++++++------ .../Institutions/InstitutionsControllerTests.js | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/services/web/app/src/Features/Institutions/InstitutionsController.js b/services/web/app/src/Features/Institutions/InstitutionsController.js index 1269fd13a9..a395cf5bef 100644 --- a/services/web/app/src/Features/Institutions/InstitutionsController.js +++ b/services/web/app/src/Features/Institutions/InstitutionsController.js @@ -63,14 +63,19 @@ function affiliateUserByReversedHostname(user, reversedHostname, callback) { ) return innerCallback(error) } - FeaturesUpdater.refreshFeatures( - user._id, - 'affiliate-user-by-reversed-hostname', - innerCallback - ) + innerCallback() } ) }, - callback + err => { + if (err) { + return callback(err) + } + FeaturesUpdater.refreshFeatures( + user._id, + 'affiliate-user-by-reversed-hostname', + callback + ) + } ) } diff --git a/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js b/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js index 15ca2dcd3c..a4a822ecdb 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js @@ -132,6 +132,7 @@ describe('InstitutionsController', function () { this.refreshFeatures .calledWith(this.stubbedUser2._id) .should.equal(true) + this.refreshFeatures.should.have.been.calledTwice return done() } this.next.callsFake(done)