mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 04:41:32 +02:00
Merge pull request #2610 from overleaf/ta-recurly-email-update-auto
Update Recurly Email on Default Email Change GitOrigin-RevId: e2821d7bdc4bc6befff2152d92c76952c38694f9
This commit is contained in:
@@ -15,6 +15,7 @@ const FeaturesUpdater = require('../Subscription/FeaturesUpdater')
|
||||
const EmailHelper = require('../Helpers/EmailHelper')
|
||||
const Errors = require('../Errors/Errors')
|
||||
const NewsletterManager = require('../Newsletter/NewsletterManager')
|
||||
const RecurlyWrapper = require('../Subscription/RecurlyWrapper')
|
||||
|
||||
const UserUpdater = {
|
||||
addAffiliationForNewUser(userId, email, callback) {
|
||||
@@ -203,6 +204,9 @@ const UserUpdater = {
|
||||
)
|
||||
}
|
||||
})
|
||||
RecurlyWrapper.updateAccountEmailAddress(user._id, email, _error => {
|
||||
// errors are ignored
|
||||
})
|
||||
callback()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -32,6 +32,7 @@ describe('UserUpdater', function() {
|
||||
this.removeAffiliation = sinon.stub().callsArgWith(2, null)
|
||||
this.refreshFeatures = sinon.stub().yields()
|
||||
this.NewsletterManager = { changeEmail: sinon.stub() }
|
||||
this.RecurlyWrapper = { updateAccountEmailAddress: sinon.stub() }
|
||||
this.UserUpdater = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
@@ -55,7 +56,8 @@ describe('UserUpdater', function() {
|
||||
},
|
||||
'settings-sharelatex': (this.settings = {}),
|
||||
request: (this.request = {}),
|
||||
'../Newsletter/NewsletterManager': this.NewsletterManager
|
||||
'../Newsletter/NewsletterManager': this.NewsletterManager,
|
||||
'../Subscription/RecurlyWrapper': this.RecurlyWrapper
|
||||
}
|
||||
})
|
||||
|
||||
@@ -350,6 +352,7 @@ describe('UserUpdater', function() {
|
||||
]
|
||||
this.UserGetter.getUser = sinon.stub().yields(null, this.stubbedUser)
|
||||
this.NewsletterManager.changeEmail.callsArgWith(2, null)
|
||||
this.RecurlyWrapper.updateAccountEmailAddress.yields(null)
|
||||
})
|
||||
|
||||
it('set default', function(done) {
|
||||
@@ -382,6 +385,9 @@ describe('UserUpdater', function() {
|
||||
this.NewsletterManager.changeEmail
|
||||
.calledWith(this.stubbedUser, this.newEmail)
|
||||
.should.equal(true)
|
||||
this.RecurlyWrapper.updateAccountEmailAddress
|
||||
.calledWith(this.stubbedUser._id, this.newEmail)
|
||||
.should.equal(true)
|
||||
done()
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user