Improve document revision creation (#5474)

This commit is contained in:
Tom Moor
2023-06-25 08:29:24 -04:00
committed by GitHub
parent 86d6117a31
commit 7940cef517
6 changed files with 42 additions and 27 deletions

View File

@@ -14,12 +14,15 @@ type Props = {
ydoc: Y.Doc;
/** The user ID that is performing the update, if known */
userId?: string;
/** Whether the last connection to the document left */
isLastConnection: boolean;
};
export default async function documentCollaborativeUpdater({
documentId,
ydoc,
userId,
isLastConnection,
}: Props) {
return sequelize.transaction(async (transaction) => {
const document = await Document.unscoped()
@@ -79,6 +82,7 @@ export default async function documentCollaborativeUpdater({
data: {
multiplayer: true,
title: document.title,
done: isLastConnection,
},
});
});