mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #1469 from sharelatex/ns-ta-refresh-features-on-donmain-confirm
refresh features on donmain confirm GitOrigin-RevId: e1c29f1c590aafefef188ddfbc50654194b0747f
This commit is contained in:
parent
f902eb7d4a
commit
4840d9e9bd
2 changed files with 7 additions and 1 deletions
|
@ -2,6 +2,7 @@ logger = require("logger-sharelatex")
|
|||
UserGetter = require("../User/UserGetter")
|
||||
{ addAffiliation } = require("../Institutions/InstitutionsAPI")
|
||||
Institution = require('../../models/Institution').Institution
|
||||
FeaturesUpdater = require('../Subscription/FeaturesUpdater')
|
||||
async = require('async')
|
||||
|
||||
module.exports = InstitutionsController =
|
||||
|
@ -36,5 +37,5 @@ affiliateUserByReversedHostname = (user, reversedHostname, callback) ->
|
|||
if error?
|
||||
logger.err error: error, 'problem adding affiliation while confirming hostname'
|
||||
return innerCallback(error)
|
||||
innerCallback()
|
||||
FeaturesUpdater.refreshFeatures user._id, true, innerCallback
|
||||
), callback
|
||||
|
|
|
@ -30,6 +30,7 @@ describe "InstitutionsController", ->
|
|||
|
||||
@getUsersByHostname = sinon.stub().callsArgWith(2, null, [ @stubbedUser1, @stubbedUser2 ])
|
||||
@addAffiliation = sinon.stub().callsArgWith(3, null)
|
||||
@refreshFeatures = sinon.stub().callsArgWith(2, null)
|
||||
@InstitutionsController = SandboxedModule.require modulePath, requires:
|
||||
'logger-sharelatex': @logger
|
||||
'../User/UserGetter':
|
||||
|
@ -38,6 +39,8 @@ describe "InstitutionsController", ->
|
|||
addAffiliation: @addAffiliation
|
||||
'../../models/Institution': Institution: @Institution =
|
||||
findOneAndUpdate: sinon.stub().yields()
|
||||
'../Subscription/FeaturesUpdater':
|
||||
refreshFeatures: @refreshFeatures
|
||||
|
||||
@req =
|
||||
body: hostname: 'mit.edu'
|
||||
|
@ -56,6 +59,8 @@ describe "InstitutionsController", ->
|
|||
@addAffiliation.calledWith(@stubbedUser1._id, @stubbedUser1.emails[0].email).should.equal true
|
||||
@addAffiliation.calledWith(@stubbedUser1._id, @stubbedUser1.emails[2].email).should.equal true
|
||||
@addAffiliation.calledWith(@stubbedUser2._id, @stubbedUser2.emails[0].email).should.equal true
|
||||
@refreshFeatures.calledWith(@stubbedUser1._id, true).should.equal true
|
||||
@refreshFeatures.calledWith(@stubbedUser2._id, true).should.equal true
|
||||
done()
|
||||
@InstitutionsController.confirmDomain @req, @res, @next
|
||||
|
||||
|
|
Loading…
Reference in a new issue