Add guard against overwriting text when collaborative editing enabled

This commit is contained in:
Tom Moor
2021-10-04 19:20:48 -07:00
parent df5dc2f691
commit e61c71766f

View File

@ -1038,11 +1038,14 @@ router.post("documents.update", auth(), async (ctx) => {
if (editorVersion) document.editorVersion = editorVersion; if (editorVersion) document.editorVersion = editorVersion;
if (templateId) document.templateId = templateId; if (templateId) document.templateId = templateId;
if (append) { if (!user.team?.collaborativeEditing) {
document.text += text; if (append) {
} else if (text !== undefined) { document.text += text;
document.text = text; } else if (text !== undefined) {
document.text = text;
}
} }
document.lastModifiedById = user.id; document.lastModifiedById = user.id;
const { collection } = document; const { collection } = document;