mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-28 18:40:48 +00:00
resyncProject -> resyncProjectHistory
This commit is contained in:
parent
50fdfec6e8
commit
5b2e7d981a
5 changed files with 13 additions and 13 deletions
|
@ -205,7 +205,7 @@ module.exports = DocumentUpdaterHandler =
|
|||
logger.error {project_id, doc_id, thread_id}, "doc updater returned a non-success status code: #{res.statusCode}"
|
||||
callback new Error("doc updater returned a non-success status code: #{res.statusCode}")
|
||||
|
||||
resyncProject: (project_id, docs, files, callback) ->
|
||||
resyncProjectHistory: (project_id, docs, files, callback) ->
|
||||
request.post
|
||||
url: "#{settings.apis.documentupdater.url}/project/#{project_id}/resync"
|
||||
json: { docs, files }
|
||||
|
|
|
@ -64,8 +64,8 @@ module.exports = HistoryController =
|
|||
else
|
||||
return settings.apis.trackchanges.url
|
||||
|
||||
resyncProject: (req, res, next = (error) ->) ->
|
||||
resyncProjectHistory: (req, res, next = (error) ->) ->
|
||||
project_id = req.params.Project_id
|
||||
ProjectEntityUpdateHandler.resyncProject project_id, (error) ->
|
||||
ProjectEntityUpdateHandler.resyncProjectHistory project_id, (error) ->
|
||||
return next(error) if error?
|
||||
res.sendStatus 204
|
||||
|
|
|
@ -315,7 +315,7 @@ module.exports = ProjectEntityUpdateHandler = self =
|
|||
|
||||
# This doesn't directly update project structure but we need to take the lock
|
||||
# to prevent anything else being queued before the resync update
|
||||
resyncProject: wrapWithLock (project_id, callback) ->
|
||||
resyncProjectHistory: wrapWithLock (project_id, callback) ->
|
||||
ProjectGetter.getProject project_id, rootFolder: true, (error, project) ->
|
||||
return callback(error) if error?
|
||||
ProjectEntityHandler.getAllEntitiesFromProject project, (error, docs, files) ->
|
||||
|
@ -330,7 +330,7 @@ module.exports = ProjectEntityUpdateHandler = self =
|
|||
path: file.path
|
||||
url: FileStoreHandler._buildUrl(project_id, file.file._id)
|
||||
|
||||
DocumentUpdaterHandler.resyncProject project_id, docs, files, callback
|
||||
DocumentUpdaterHandler.resyncProjectHistory project_id, docs, files, callback
|
||||
|
||||
_cleanUpEntity: (project, entity, entityType, path, userId, callback = (error) ->) ->
|
||||
if(entityType.indexOf("file") != -1)
|
||||
|
|
|
@ -201,19 +201,19 @@ describe "HistoryController", ->
|
|||
it "should not return the data with users to the client", ->
|
||||
@res.json.calledWith(@data_with_users).should.equal false
|
||||
|
||||
describe "resyncProject", ->
|
||||
describe "resyncProjectHistory", ->
|
||||
beforeEach ->
|
||||
@project_id = 'mock-project-id'
|
||||
@req = params: Project_id: @project_id
|
||||
@res = sendStatus: sinon.stub()
|
||||
@next = sinon.stub()
|
||||
|
||||
@ProjectEntityUpdateHandler.resyncProject = sinon.stub().yields()
|
||||
@ProjectEntityUpdateHandler.resyncProjectHistory = sinon.stub().yields()
|
||||
|
||||
@HistoryController.resyncProject @req, @res, @next
|
||||
@HistoryController.resyncProjectHistory @req, @res, @next
|
||||
|
||||
it "resyncs the project", ->
|
||||
@ProjectEntityUpdateHandler.resyncProject
|
||||
@ProjectEntityUpdateHandler.resyncProjectHistory
|
||||
.calledWith(@project_id)
|
||||
.should.equal true
|
||||
|
||||
|
|
|
@ -745,7 +745,7 @@ describe 'ProjectEntityUpdateHandler', ->
|
|||
.calledWith(project_id, userId, @changes, @callback)
|
||||
.should.equal true
|
||||
|
||||
describe "resyncProject", ->
|
||||
describe "resyncProjectHistory", ->
|
||||
beforeEach ->
|
||||
@ProjectGetter.getProject = sinon.stub().yields(null, @project)
|
||||
docs = [
|
||||
|
@ -759,9 +759,9 @@ describe 'ProjectEntityUpdateHandler', ->
|
|||
@ProjectEntityHandler.getAllEntitiesFromProject = sinon.stub().yields(null, docs, files)
|
||||
@FileStoreHandler._buildUrl = (project_id, file_id) ->
|
||||
"www.filestore.test/#{project_id}/#{file_id}"
|
||||
@DocumentUpdaterHandler.resyncProject = sinon.stub().yields()
|
||||
@DocumentUpdaterHandler.resyncProjectHistory = sinon.stub().yields()
|
||||
|
||||
@ProjectEntityUpdateHandler.resyncProject project_id, @callback
|
||||
@ProjectEntityUpdateHandler.resyncProjectHistory project_id, @callback
|
||||
|
||||
it 'gets the project', ->
|
||||
@ProjectGetter.getProject
|
||||
|
@ -783,7 +783,7 @@ describe 'ProjectEntityUpdateHandler', ->
|
|||
path: 'universe.png'
|
||||
url: "www.filestore.test/#{project_id}/#{file_id}"
|
||||
]
|
||||
@DocumentUpdaterHandler.resyncProject
|
||||
@DocumentUpdaterHandler.resyncProjectHistory
|
||||
.calledWith(project_id, docs, files)
|
||||
.should.equal true
|
||||
|
||||
|
|
Loading…
Reference in a new issue