mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
ProjectDeleter.archiveProject doesn't need to get entire project
This commit is contained in:
parent
447568aa91
commit
b6d62a677b
2 changed files with 6 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
Project = require('../../models/Project').Project
|
Project = require('../../models/Project').Project
|
||||||
|
ProjectGetter = require("./ProjectGetter")
|
||||||
logger = require('logger-sharelatex')
|
logger = require('logger-sharelatex')
|
||||||
documentUpdaterHandler = require('../DocumentUpdater/DocumentUpdaterHandler')
|
documentUpdaterHandler = require('../DocumentUpdater/DocumentUpdaterHandler')
|
||||||
tagsHandler = require("../Tags/TagsHandler")
|
tagsHandler = require("../Tags/TagsHandler")
|
||||||
|
@ -34,7 +35,7 @@ module.exports = ProjectDeleter =
|
||||||
|
|
||||||
archiveProject: (project_id, callback = (error) ->)->
|
archiveProject: (project_id, callback = (error) ->)->
|
||||||
logger.log project_id:project_id, "deleting project"
|
logger.log project_id:project_id, "deleting project"
|
||||||
Project.findById project_id, (err, project)=>
|
ProjectGetter.getProject project_id, {owner_ref:1, collaberator_refs:1, readOnly_refs:1}, (err, project)=>
|
||||||
if err? or !project?
|
if err? or !project?
|
||||||
logger.err err:err, project_id:project_id, "error getting project to delete it"
|
logger.err err:err, project_id:project_id, "error getting project to delete it"
|
||||||
callback(err)
|
callback(err)
|
||||||
|
|
|
@ -25,12 +25,15 @@ describe 'ProjectDeleter', ->
|
||||||
@editorController = notifyUsersProjectHasBeenDeletedOrRenamed : sinon.stub().callsArgWith(1)
|
@editorController = notifyUsersProjectHasBeenDeletedOrRenamed : sinon.stub().callsArgWith(1)
|
||||||
@TagsHandler =
|
@TagsHandler =
|
||||||
removeProjectFromAllTags: sinon.stub().callsArgWith(2)
|
removeProjectFromAllTags: sinon.stub().callsArgWith(2)
|
||||||
|
@ProjectGetter =
|
||||||
|
getProject:sinon.stub()
|
||||||
@deleter = SandboxedModule.require modulePath, requires:
|
@deleter = SandboxedModule.require modulePath, requires:
|
||||||
"../Editor/EditorController": @editorController
|
"../Editor/EditorController": @editorController
|
||||||
'../../models/Project':{Project:@Project}
|
'../../models/Project':{Project:@Project}
|
||||||
'../DocumentUpdater/DocumentUpdaterHandler': @documentUpdaterHandler
|
'../DocumentUpdater/DocumentUpdaterHandler': @documentUpdaterHandler
|
||||||
"../Tags/TagsHandler":@TagsHandler
|
"../Tags/TagsHandler":@TagsHandler
|
||||||
"../FileStore/FileStoreHandler": @FileStoreHandler = {}
|
"../FileStore/FileStoreHandler": @FileStoreHandler = {}
|
||||||
|
"./ProjectGetter": @ProjectGetter
|
||||||
'logger-sharelatex':
|
'logger-sharelatex':
|
||||||
log:->
|
log:->
|
||||||
|
|
||||||
|
@ -89,6 +92,7 @@ describe 'ProjectDeleter', ->
|
||||||
|
|
||||||
describe "archiveProject", ->
|
describe "archiveProject", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ProjectGetter.getProject.callsArgWith(2, null, @project)
|
||||||
@Project.update.callsArgWith(2)
|
@Project.update.callsArgWith(2)
|
||||||
|
|
||||||
it "should flushProjectToMongoAndDelete in doc updater", (done)->
|
it "should flushProjectToMongoAndDelete in doc updater", (done)->
|
||||||
|
|
Loading…
Reference in a new issue