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 (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;