This commit is contained in:
Tom Moor committed 2026-07-12 07:29:14 -04:00
1 parent e0d5aafee2
commit 79a2cd99eb
11 files changed
+96 -93

No files matched your search

+5 -25
View File
@@ -372,16 +372,6 @@ class Collection extends ParanoidModel<
return `/collection/${slugifiedName}-${urlId}`;
}
/**
* Returns the key used to store the collaborators of a collection in Redis.
*
* @param collectionId The ID of the collection.
* @returns Redis key for collaborators.
*/
static getCollaboratorKey(collectionId: string) {
return `collaborators:${collectionId}`;
}
/**
* Whether this collection is considered active or not. A collection is active if
* it has not been archived or deleted.
@@ -461,21 +451,11 @@ class Collection extends ParanoidModel<
@AfterUpdate
static notifyCollaborationServer(model: Collection, ctx: HookContext) {
if (model.changed("state") && ctx.auth?.user?.id) {
const actorId = ctx.auth.user.id;
const notify = async () => {
await APIUpdateExtension.notifyUpdate(
toMultiplayerName(MultiplayerEntityType.Collection, model.id),
actorId
);
};
if (ctx.transaction) {
const transaction = ctx.transaction.parent || ctx.transaction;
transaction.afterCommit(notify);
} else {
void notify();
}
if (model.changed("state")) {
APIUpdateExtension.notifyUpdateAfterCommit(
toMultiplayerName(MultiplayerEntityType.Collection, model.id),
ctx
);
}
}
+5 -24
View File
@@ -422,15 +422,6 @@ class Document extends ArchivableModel<
);
}
/**
* Returns the key used to store the collaborators of a document in Redis.
* @param documentId The ID of the document.
* @returns Redis key for collaborators
*/
static getCollaboratorKey(documentId: string) {
return `collaborators:${documentId}`;
}
static getPath({ title, urlId }: { title: string; urlId: string }) {
if (!title.length) {
return `/doc/untitled-${urlId}`;
@@ -589,21 +580,11 @@ class Document extends ArchivableModel<
@AfterUpdate
static notifyCollaborationServer(model: Document, ctx: HookContext) {
if (model.changed("state") && ctx.auth?.user?.id) {
const actorId = ctx.auth.user.id;
const notify = async () => {
await APIUpdateExtension.notifyUpdate(
toMultiplayerName(MultiplayerEntityType.Document, model.id),
actorId
);
};
if (ctx.transaction) {
const transaction = ctx.transaction.parent || ctx.transaction;
transaction.afterCommit(notify);
} else {
void notify();
}
if (model.changed("state")) {
APIUpdateExtension.notifyUpdateAfterCommit(
toMultiplayerName(MultiplayerEntityType.Document, model.id),
ctx
);
}
}