mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-28 22:31:30 +00:00
ignore affiliations if v1 is not configured
This commit is contained in:
parent
d3b2a2650f
commit
e41391fb4a
2 changed files with 5 additions and 4 deletions
|
@ -132,7 +132,8 @@ removeAffiliation = (userId, email, callback = (error) ->) ->
|
|||
defaultErrorMessage: "Couldn't remove affiliation"
|
||||
}, callback
|
||||
|
||||
makeAffiliationRequest = (requestOptions, callback = (error) ->) ->
|
||||
makeAffiliationRequest = (requestOptions, callback = (error) ->) ->
|
||||
return callback(null) unless settings?.apis?.v1?.url # service is not configured
|
||||
requestOptions.extraSuccessStatusCodes ||= []
|
||||
request {
|
||||
method: requestOptions.method
|
||||
|
|
|
@ -19,7 +19,7 @@ describe "UserUpdater", ->
|
|||
getUserByAnyEmail: sinon.stub()
|
||||
ensureUniqueEmailAddress: sinon.stub()
|
||||
@logger = err: sinon.stub(), log: ->
|
||||
settings = apis: { v1: { url: '', user: '', pass: '' } }
|
||||
settings = apis: { v1: { url: 'v1.url', user: '', pass: '' } }
|
||||
@request = sinon.stub()
|
||||
@UserUpdater = SandboxedModule.require modulePath, requires:
|
||||
"logger-sharelatex": @logger
|
||||
|
@ -90,7 +90,7 @@ describe "UserUpdater", ->
|
|||
should.not.exist(err)
|
||||
@request.calledOnce.should.equal true
|
||||
requestOptions = @request.lastCall.args[0]
|
||||
expectedUrl = "/api/v2/users/#{@stubbedUser._id}/affiliations"
|
||||
expectedUrl = "v1.url/api/v2/users/#{@stubbedUser._id}/affiliations"
|
||||
requestOptions.url.should.equal expectedUrl
|
||||
requestOptions.method.should.equal 'POST'
|
||||
|
||||
|
@ -138,7 +138,7 @@ describe "UserUpdater", ->
|
|||
should.not.exist(err)
|
||||
@request.calledOnce.should.equal true
|
||||
requestOptions = @request.lastCall.args[0]
|
||||
expectedUrl = "/api/v2/users/#{@stubbedUser._id}/affiliations/"
|
||||
expectedUrl = "v1.url/api/v2/users/#{@stubbedUser._id}/affiliations/"
|
||||
expectedUrl += encodeURIComponent(@newEmail)
|
||||
requestOptions.url.should.equal expectedUrl
|
||||
requestOptions.method.should.equal 'DELETE'
|
||||
|
|
Loading…
Reference in a new issue