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)