diff --git a/services/web/app/coffee/Features/Templates/TemplatesController.coffee b/services/web/app/coffee/Features/Templates/TemplatesController.coffee index fce6c9502c..c4525f1012 100644 --- a/services/web/app/coffee/Features/Templates/TemplatesController.coffee +++ b/services/web/app/coffee/Features/Templates/TemplatesController.coffee @@ -45,6 +45,7 @@ module.exports = TemplatesController = docId: req.body.docId templateId: req.body.templateId templateVersionId: req.body.templateVersionId + image: 'wl_texlive:2018.1' }, req, res @@ -63,18 +64,25 @@ module.exports = TemplatesController = logger.err err:err, zipReq:zipReq, "problem building project from zip" return res.sendStatus 500 setCompiler project._id, options.compiler, -> - fs.unlink dumpPath, -> - delete req.session.templateData - conditions = {_id:project._id} - update = { - fromV1TemplateId:options.templateId, - fromV1TemplateVersionId:options.templateVersionId - } - Project.update conditions, update, {}, (err)-> - res.redirect "/project/#{project._id}" + setImage project._id, options.image, -> + fs.unlink dumpPath, -> + delete req.session.templateData + conditions = {_id:project._id} + update = { + fromV1TemplateId:options.templateId, + fromV1TemplateVersionId:options.templateVersionId + } + Project.update conditions, update, {}, (err)-> + res.redirect "/project/#{project._id}" setCompiler = (project_id, compiler, callback)-> if compiler? ProjectOptionsHandler.setCompiler project_id, compiler, callback else callback() + +setImage = (project_id, imageName, callback)-> + if imageName? + ProjectOptionsHandler.setImageName project_id, imageName, callback + else + callback() diff --git a/services/web/test/unit/coffee/Templates/TemplatesControllerTests.coffee b/services/web/test/unit/coffee/Templates/TemplatesControllerTests.coffee index 5cf52eca39..8a90245373 100644 --- a/services/web/test/unit/coffee/Templates/TemplatesControllerTests.coffee +++ b/services/web/test/unit/coffee/Templates/TemplatesControllerTests.coffee @@ -22,7 +22,10 @@ describe 'TemplatesController', -> } @ProjectUploadManager = {createProjectFromZipArchive : sinon.stub().callsArgWith(3, null, {_id:project_id})} @dumpFolder = "dump/path" - @ProjectOptionsHandler = {setCompiler:sinon.stub().callsArgWith(2)} + @ProjectOptionsHandler = { + setCompiler:sinon.stub().callsArgWith(2) + setImageName:sinon.stub().callsArgWith(2) + } @uuid = "1234" @ProjectDetailsHandler = getProjectDescription:sinon.stub()