mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
change update to projectUpdate in project related methods
This commit is contained in:
parent
779f00f912
commit
dd0f8b880a
2 changed files with 33 additions and 33 deletions
|
@ -7,49 +7,49 @@ module.exports = ProjectHistoryRedisManager =
|
||||||
queueOps: (project_id, ops..., callback) ->
|
queueOps: (project_id, ops..., callback) ->
|
||||||
rclient.rpush projectHistoryKeys.projectHistoryOps({project_id}), ops..., callback
|
rclient.rpush projectHistoryKeys.projectHistoryOps({project_id}), ops..., callback
|
||||||
|
|
||||||
queueRenameEntity: (project_id, entity_type, entity_id, user_id, update, callback) ->
|
queueRenameEntity: (project_id, entity_type, entity_id, user_id, projectUpdate, callback) ->
|
||||||
update =
|
projectUpdate =
|
||||||
pathname: update.pathname
|
pathname: projectUpdate.pathname
|
||||||
new_pathname: update.newPathname
|
new_pathname: projectUpdate.newPathname
|
||||||
meta:
|
meta:
|
||||||
user_id: user_id
|
user_id: user_id
|
||||||
ts: new Date()
|
ts: new Date()
|
||||||
version: update.version
|
version: projectUpdate.version
|
||||||
update[entity_type] = entity_id
|
projectUpdate[entity_type] = entity_id
|
||||||
|
|
||||||
logger.log {project_id, update}, "queue rename operation to project-history"
|
logger.log {project_id, projectUpdate}, "queue rename operation to project-history"
|
||||||
jsonUpdate = JSON.stringify(update)
|
jsonUpdate = JSON.stringify(projectUpdate)
|
||||||
|
|
||||||
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
||||||
|
|
||||||
queueAddEntity: (project_id, entity_type, entitiy_id, user_id, update, callback = (error) ->) ->
|
queueAddEntity: (project_id, entity_type, entitiy_id, user_id, projectUpdate, callback = (error) ->) ->
|
||||||
update =
|
projectUpdate =
|
||||||
pathname: update.pathname
|
pathname: projectUpdate.pathname
|
||||||
docLines: update.docLines
|
docLines: projectUpdate.docLines
|
||||||
url: update.url
|
url: projectUpdate.url
|
||||||
meta:
|
meta:
|
||||||
user_id: user_id
|
user_id: user_id
|
||||||
ts: new Date()
|
ts: new Date()
|
||||||
version: update.version
|
version: projectUpdate.version
|
||||||
update[entity_type] = entitiy_id
|
projectUpdate[entity_type] = entitiy_id
|
||||||
|
|
||||||
logger.log {project_id, update}, "queue add operation to project-history"
|
logger.log {project_id, projectUpdate}, "queue add operation to project-history"
|
||||||
jsonUpdate = JSON.stringify(update)
|
jsonUpdate = JSON.stringify(projectUpdate)
|
||||||
|
|
||||||
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
||||||
|
|
||||||
queueResyncProjectStructure: (project_id, docs, files, callback) ->
|
queueResyncProjectStructure: (project_id, docs, files, callback) ->
|
||||||
logger.log {project_id, docs, files}, "queue project structure resync"
|
logger.log {project_id, docs, files}, "queue project structure resync"
|
||||||
update =
|
projectUpdate =
|
||||||
resyncProjectStructure: { docs, files }
|
resyncProjectStructure: { docs, files }
|
||||||
meta:
|
meta:
|
||||||
ts: new Date()
|
ts: new Date()
|
||||||
jsonUpdate = JSON.stringify update
|
jsonUpdate = JSON.stringify projectUpdate
|
||||||
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
||||||
|
|
||||||
queueResyncDocContent: (project_id, doc_id, lines, version, pathname, callback) ->
|
queueResyncDocContent: (project_id, doc_id, lines, version, pathname, callback) ->
|
||||||
logger.log {project_id, doc_id, lines, version, pathname}, "queue doc content resync"
|
logger.log {project_id, doc_id, lines, version, pathname}, "queue doc content resync"
|
||||||
update =
|
projectUpdate =
|
||||||
resyncDocContent:
|
resyncDocContent:
|
||||||
content: lines.join("\n"),
|
content: lines.join("\n"),
|
||||||
version: version
|
version: version
|
||||||
|
@ -57,5 +57,5 @@ module.exports = ProjectHistoryRedisManager =
|
||||||
doc: doc_id
|
doc: doc_id
|
||||||
meta:
|
meta:
|
||||||
ts: new Date()
|
ts: new Date()
|
||||||
jsonUpdate = JSON.stringify update
|
jsonUpdate = JSON.stringify projectUpdate
|
||||||
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
ProjectHistoryRedisManager.queueOps project_id, jsonUpdate, callback
|
||||||
|
|
|
@ -116,27 +116,27 @@ module.exports = ProjectManager =
|
||||||
|
|
||||||
project_ops_length = 0
|
project_ops_length = 0
|
||||||
|
|
||||||
handleDocUpdate = (update, cb) ->
|
handleDocUpdate = (projectUpdate, cb) ->
|
||||||
doc_id = update.id
|
doc_id = projectUpdate.id
|
||||||
update.version = "#{project_version}.#{project_subversion++}"
|
projectUpdate.version = "#{project_version}.#{project_subversion++}"
|
||||||
if update.docLines?
|
if projectUpdate.docLines?
|
||||||
ProjectHistoryRedisManager.queueAddEntity project_id, 'doc', doc_id, user_id, update, (error, count) ->
|
ProjectHistoryRedisManager.queueAddEntity project_id, 'doc', doc_id, user_id, projectUpdate, (error, count) ->
|
||||||
project_ops_length = count
|
project_ops_length = count
|
||||||
cb(error)
|
cb(error)
|
||||||
else
|
else
|
||||||
DocumentManager.renameDocWithLock project_id, doc_id, user_id, update, (error, count) ->
|
DocumentManager.renameDocWithLock project_id, doc_id, user_id, projectUpdate, (error, count) ->
|
||||||
project_ops_length = count
|
project_ops_length = count
|
||||||
cb(error)
|
cb(error)
|
||||||
|
|
||||||
handleFileUpdate = (update, cb) ->
|
handleFileUpdate = (projectUpdate, cb) ->
|
||||||
file_id = update.id
|
file_id = projectUpdate.id
|
||||||
update.version = "#{project_version}.#{project_subversion++}"
|
projectUpdate.version = "#{project_version}.#{project_subversion++}"
|
||||||
if update.url?
|
if projectUpdate.url?
|
||||||
ProjectHistoryRedisManager.queueAddEntity project_id, 'file', file_id, user_id, update, (error, count) ->
|
ProjectHistoryRedisManager.queueAddEntity project_id, 'file', file_id, user_id, projectUpdate, (error, count) ->
|
||||||
project_ops_length = count
|
project_ops_length = count
|
||||||
cb(error)
|
cb(error)
|
||||||
else
|
else
|
||||||
ProjectHistoryRedisManager.queueRenameEntity project_id, 'file', file_id, user_id, update, (error, count) ->
|
ProjectHistoryRedisManager.queueRenameEntity project_id, 'file', file_id, user_id, projectUpdate, (error, count) ->
|
||||||
project_ops_length = count
|
project_ops_length = count
|
||||||
cb(error)
|
cb(error)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue