mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
[history-ot] initial implementation of using doc-level history-ot (#25054)
* [history-v1-ot] initial implementation of using doc-level history-v1-ot * [web] fix advancing of the otMigrationStage Use 'nextStage' for the user provided, desired stage when advancing. Co-authored-by: Brian Gough <brian.gough@overleaf.com> * [document-updater] document size check in editor-core * [history-ot] rename history-v1-ot to history-ot and add types * [history-ot] apply review feedback - remove extra !! - merge variable assignment when processing diff-match-match output - add helper function for getting docstore lines view of StringFileData Co-authored-by: Alf Eaton <alf.eaton@overleaf.com> * Revert "[document-updater] add safe rollback point for history-ot (#25283)" This reverts commit d7230dd14a379a27d2c6ab03a006463a18979d06 Signed-off-by: Jakob Ackermann <jakob.ackermann@overleaf.com> --------- Signed-off-by: Jakob Ackermann <jakob.ackermann@overleaf.com> Co-authored-by: Brian Gough <brian.gough@overleaf.com> Co-authored-by: Alf Eaton <alf.eaton@overleaf.com> GitOrigin-RevId: 89c497782adb0427635d50d02263d6f535b12481
This commit is contained in:
committed by
Copybot
co-authored by
Alf Eaton
Brian Gough
parent
4d93187e58
commit
e8b5ee2ff9
@@ -15,9 +15,10 @@ const RangesManager = require('./RangesManager')
|
||||
const SnapshotManager = require('./SnapshotManager')
|
||||
const Profiler = require('./Profiler')
|
||||
const { isInsert, isDelete, getDocLength, computeDocHash } = require('./Utils')
|
||||
const HistoryV1OTUpdateManager = require('./HistoryV1OTUpdateManager')
|
||||
|
||||
/**
|
||||
* @import { DeleteOp, InsertOp, Op, Ranges, Update, HistoryUpdate } from "./types"
|
||||
* @import { Ranges, Update, HistoryUpdate } from "./types"
|
||||
*/
|
||||
|
||||
const UpdateManager = {
|
||||
@@ -80,7 +81,11 @@ const UpdateManager = {
|
||||
profile.log('getPendingUpdatesForDoc')
|
||||
|
||||
for (const update of updates) {
|
||||
await UpdateManager.applyUpdate(projectId, docId, update)
|
||||
if (HistoryV1OTUpdateManager.isHistoryOTEditOperationUpdate(update)) {
|
||||
await HistoryV1OTUpdateManager.applyUpdate(projectId, docId, update)
|
||||
} else {
|
||||
await UpdateManager.applyUpdate(projectId, docId, update)
|
||||
}
|
||||
profile.log('applyUpdate')
|
||||
}
|
||||
profile.log('async done').end()
|
||||
@@ -110,12 +115,16 @@ const UpdateManager = {
|
||||
pathname,
|
||||
projectHistoryId,
|
||||
historyRangesSupport,
|
||||
type,
|
||||
} = await DocumentManager.promises.getDoc(projectId, docId)
|
||||
profile.log('getDoc')
|
||||
|
||||
if (lines == null || version == null) {
|
||||
throw new Errors.NotFoundError(`document not found: ${docId}`)
|
||||
}
|
||||
if (type !== 'sharejs-text-ot') {
|
||||
throw new Errors.OTTypeMismatchError(type, 'sharejs-text-ot')
|
||||
}
|
||||
|
||||
const previousVersion = version
|
||||
const incomingUpdateVersion = update.v
|
||||
|
||||
Reference in New Issue
Block a user