From e61c71766f660d7a7ff57cfba8b5d4594babdae5 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 4 Oct 2021 19:20:48 -0700 Subject: [PATCH] Add guard against overwriting text when collaborative editing enabled --- server/routes/api/documents.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/routes/api/documents.js b/server/routes/api/documents.js index 70eabae55..a10dc7eeb 100644 --- a/server/routes/api/documents.js +++ b/server/routes/api/documents.js @@ -1038,11 +1038,14 @@ router.post("documents.update", auth(), async (ctx) => { if (editorVersion) document.editorVersion = editorVersion; if (templateId) document.templateId = templateId; - if (append) { - document.text += text; - } else if (text !== undefined) { - document.text = text; + if (!user.team?.collaborativeEditing) { + if (append) { + document.text += text; + } else if (text !== undefined) { + document.text = text; + } } + document.lastModifiedById = user.id; const { collection } = document;