mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge remote-tracking branch 'origin/sk-admin-panel-projects'
GitOrigin-RevId: 56f17fe3bec6252bd3d933899e540813550a36ff
This commit is contained in:
parent
bd9adbae52
commit
d2bccbec25
2 changed files with 20 additions and 0 deletions
|
@ -57,3 +57,13 @@ module.exports =
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, "error setting brandVariationId"
|
logger.err err:err, "error setting brandVariationId"
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
|
unsetBrandVariationId: (project_id, callback = ()->)->
|
||||||
|
logger.log project_id:project_id, "unsetting the brand variation id"
|
||||||
|
conditions = {_id:project_id}
|
||||||
|
update = {$unset: {brandVariationId: 1}}
|
||||||
|
Project.update conditions, update, {}, (err)->
|
||||||
|
if err?
|
||||||
|
logger.err err:err, "error unsetting brandVariationId"
|
||||||
|
return callback(err)
|
||||||
|
callback()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
sinon = require('sinon')
|
sinon = require('sinon')
|
||||||
chai = require('chai')
|
chai = require('chai')
|
||||||
|
expect = chai.expect
|
||||||
should = chai.should()
|
should = chai.should()
|
||||||
modulePath = "../../../../app/js/Features/Project/ProjectOptionsHandler.js"
|
modulePath = "../../../../app/js/Features/Project/ProjectOptionsHandler.js"
|
||||||
SandboxedModule = require('sandboxed-module')
|
SandboxedModule = require('sandboxed-module')
|
||||||
|
@ -97,3 +98,12 @@ describe 'ProjectOptionsHandler', ->
|
||||||
@handler.setBrandVariationId project_id, "", (err)=>
|
@handler.setBrandVariationId project_id, "", (err)=>
|
||||||
@projectModel.update.called.should.equal false
|
@projectModel.update.called.should.equal false
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
describe "unsetting the brandVariationId", ->
|
||||||
|
it 'should perform and update on mongo', (done)->
|
||||||
|
@handler.unsetBrandVariationId project_id, (err)=>
|
||||||
|
args = @projectModel.update.args[0]
|
||||||
|
args[0]._id.should.equal project_id
|
||||||
|
expect(args[1]).to.deep.equal {$unset: {brandVariationId: 1}}
|
||||||
|
done()
|
||||||
|
@projectModel.update.args[0][3]()
|
||||||
|
|
Loading…
Reference in a new issue