Explorar el Código

Merge pull request #2883 from overleaf/ta-email-remove-features-refresh

Refresh User's Features After Removing Email

GitOrigin-RevId: 0085a5341a806d1d22f4a1fb5bb98c93675e242e
Shane Kilkelly hace 6 años
padre
commit
74313e4b82

+ 1 - 1
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)
       })
     })
   },

+ 12 - 0
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()