|
@@ -207,8 +207,8 @@ module.exports = DocumentUpdaterHandler =
|
|
|
updateProjectStructure : (project_id, userId, changes, callback = (error) ->)->
|
|
updateProjectStructure : (project_id, userId, changes, callback = (error) ->)->
|
|
|
return callback() if !settings.apis.project_history?.enabled
|
|
return callback() if !settings.apis.project_history?.enabled
|
|
|
|
|
|
|
|
- docUpdates = DocumentUpdaterHandler._getRenameUpdates('doc', changes.oldDocs, changes.newDocs)
|
|
|
|
|
- fileUpdates = DocumentUpdaterHandler._getRenameUpdates('file', changes.oldFiles, changes.newFiles)
|
|
|
|
|
|
|
+ docUpdates = DocumentUpdaterHandler._getUpdates('doc', changes.oldDocs, changes.newDocs)
|
|
|
|
|
+ fileUpdates = DocumentUpdaterHandler._getUpdates('file', changes.oldFiles, changes.newFiles)
|
|
|
|
|
|
|
|
timer = new metrics.Timer("set-document")
|
|
timer = new metrics.Timer("set-document")
|
|
|
url = "#{settings.apis.documentupdater.url}/project/#{project_id}"
|
|
url = "#{settings.apis.documentupdater.url}/project/#{project_id}"
|
|
@@ -230,7 +230,7 @@ module.exports = DocumentUpdaterHandler =
|
|
|
logger.error {project_id, url}, "doc updater returned a non-success status code: #{res.statusCode}"
|
|
logger.error {project_id, url}, "doc updater returned a non-success status code: #{res.statusCode}"
|
|
|
callback new Error("doc updater returned a non-success status code: #{res.statusCode}")
|
|
callback new Error("doc updater returned a non-success status code: #{res.statusCode}")
|
|
|
|
|
|
|
|
- _getRenameUpdates: (entityType, oldEntities, newEntities) ->
|
|
|
|
|
|
|
+ _getUpdates: (entityType, oldEntities, newEntities) ->
|
|
|
oldEntities ||= []
|
|
oldEntities ||= []
|
|
|
newEntities ||= []
|
|
newEntities ||= []
|
|
|
updates = []
|
|
updates = []
|
|
@@ -255,6 +255,15 @@ module.exports = DocumentUpdaterHandler =
|
|
|
pathname: oldEntity.path
|
|
pathname: oldEntity.path
|
|
|
newPathname: newEntity.path
|
|
newPathname: newEntity.path
|
|
|
|
|
|
|
|
|
|
+ for id, oldEntity of oldEntitiesHash
|
|
|
|
|
+ newEntity = newEntitiesHash[id]
|
|
|
|
|
+
|
|
|
|
|
+ if !newEntity?
|
|
|
|
|
+ # entity deleted
|
|
|
|
|
+ updates.push
|
|
|
|
|
+ id: id
|
|
|
|
|
+ pathname: oldEntity.path
|
|
|
|
|
+
|
|
|
updates
|
|
updates
|
|
|
|
|
|
|
|
PENDINGUPDATESKEY = "PendingUpdates"
|
|
PENDINGUPDATESKEY = "PendingUpdates"
|