mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Don't error on project clone if not root doc is set
This commit is contained in:
parent
40704b486e
commit
639424f664
2 changed files with 11 additions and 1 deletions
|
@ -54,7 +54,10 @@ module.exports =
|
|||
|
||||
findRootDoc : (opts, callback)->
|
||||
getRootDoc = (project)=>
|
||||
@findElement {project:project, element_id:project.rootDoc_id, type:"docs"}, callback
|
||||
if project.rootDoc_id?
|
||||
@findElement {project:project, element_id:project.rootDoc_id, type:"docs"}, callback
|
||||
else
|
||||
callback null, null
|
||||
{project, project_id} = opts
|
||||
if project?
|
||||
getRootDoc project
|
||||
|
|
|
@ -159,6 +159,13 @@ describe 'project model', ->
|
|||
assert !err?
|
||||
doc._id.should.equal rootDoc._id
|
||||
done()
|
||||
|
||||
it 'should return null when the project has no rootDoc', (done) ->
|
||||
project.rootDoc_id = null
|
||||
@locator.findRootDoc project, (err, doc)->
|
||||
assert !err?
|
||||
expect(doc).to.equal null
|
||||
done()
|
||||
|
||||
describe 'findElementByPath', ->
|
||||
|
||||
|
|
Loading…
Reference in a new issue