From 74313e4b82c827617b5897a7a5682711646f26c1 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 4 Jun 2020 09:47:02 +0100 Subject: [PATCH] Merge pull request #2883 from overleaf/ta-email-remove-features-refresh Refresh User's Features After Removing Email GitOrigin-RevId: 0085a5341a806d1d22f4a1fb5bb98c93675e242e --- services/web/app/src/Features/User/UserUpdater.js | 2 +- services/web/test/unit/src/User/UserUpdaterTests.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/services/web/app/src/Features/User/UserUpdater.js b/services/web/app/src/Features/User/UserUpdater.js index 108d1d9a4a..6e0dc27ebe 100644 --- a/services/web/app/src/Features/User/UserUpdater.js +++ b/services/web/app/src/Features/User/UserUpdater.js @@ -155,7 +155,7 @@ const UserUpdater = { if (res.n === 0) { return callback(new Error('Cannot remove email')) } - callback() + FeaturesUpdater.refreshFeatures(userId, callback) }) }) }, diff --git a/services/web/test/unit/src/User/UserUpdaterTests.js b/services/web/test/unit/src/User/UserUpdaterTests.js index fb79ea8797..ab12ccd5a2 100644 --- a/services/web/test/unit/src/User/UserUpdaterTests.js +++ b/services/web/test/unit/src/User/UserUpdaterTests.js @@ -293,6 +293,18 @@ describe('UserUpdater', function() { ) }) + it('refresh features', function(done) { + this.UserUpdater.removeEmailAddress( + this.stubbedUser._id, + this.newEmail, + err => { + should.not.exist(err) + sinon.assert.calledWith(this.refreshFeatures, this.stubbedUser._id) + done() + } + ) + }) + it('handle error', function(done) { this.UserUpdater.updateUser = sinon .stub()