Split project_history.enable in initializeHistoryForNewProjects and sendProjectStructureOps

This commit is contained in:
James Allen 2017-12-14 15:38:20 +00:00
parent dfe6e26946
commit 8311101ec0
2 changed files with 5 additions and 4 deletions

View file

@ -205,7 +205,7 @@ module.exports = DocumentUpdaterHandler =
callback new Error("doc updater returned a non-success status code: #{res.statusCode}")
updateProjectStructure : (project_id, userId, changes, callback = (error) ->)->
return callback() if !settings.apis.project_history?.enabled
return callback() if !settings.apis.project_history?.sendProjectStructureOps
docUpdates = DocumentUpdaterHandler._getRenameUpdates('doc', changes.oldDocs, changes.newDocs)
fileUpdates = DocumentUpdaterHandler._getRenameUpdates('file', changes.oldFiles, changes.newFiles)

View file

@ -6,7 +6,7 @@ ProjectDetailsHandler = require "../Project/ProjectDetailsHandler"
module.exports = HistoryController =
initializeProject: (callback = (error, history_id) ->) ->
return callback() if !settings.apis.project_history?.enabled
return callback() if !settings.apis.project_history?.initializeHistoryForNewProjects
request.post {
url: "#{settings.apis.project_history.url}/project"
}, (error, res, body)->
@ -33,7 +33,8 @@ module.exports = HistoryController =
# find out which type of history service this project uses
ProjectDetailsHandler.getDetails project_id, (err, project) ->
return next(err) if err?
if project?.overleaf?.history?.display
history = project.overleaf?.history
if history?.id? and history?.display
req.useProjectHistory = true
else
req.useProjectHistory = false
@ -58,7 +59,7 @@ module.exports = HistoryController =
buildHistoryServiceUrl: (useProjectHistory) ->
# choose a history service, either document-level (trackchanges)
# or project-level (project_history)
if settings.apis.project_history?.enabled && useProjectHistory
if useProjectHistory
return settings.apis.project_history.url
else
return settings.apis.trackchanges.url