overleaf/services/document-updater/app/coffee/TrackChangesManager.coffee

12 lines
514 B
CoffeeScript
Raw Normal View History

2016-11-28 05:14:42 -05:00
ChangesTracker = require "./ChangesTracker"
module.exports = TrackChangesManager =
applyUpdate: (project_id, doc_id, entries = {}, updates = [], callback = (error, new_entries) ->) ->
2016-11-28 05:14:42 -05:00
{changes, comments} = entries
changesTracker = new ChangesTracker(changes, comments)
for update in updates
changesTracker.track_changes = !!update.meta.tc
2016-11-28 05:14:42 -05:00
for op in update.op
changesTracker.applyOp(op, { user_id: update.meta?.user_id })
2016-11-28 05:14:42 -05:00
{changes, comments} = changesTracker
callback null, {changes, comments}