From aa579412d0dfbb7310f262cd89c3abe43041f3e7 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 2 Nov 2024 19:27:17 -0400 Subject: [PATCH] Remove explicit passing of transaction to createWithContext --- server/routes/api/collections/collections.ts | 18 ++++------ server/routes/api/comments/comments.ts | 36 ++++++++----------- .../routes/api/integrations/integrations.ts | 12 +++---- 3 files changed, 24 insertions(+), 42 deletions(-) diff --git a/server/routes/api/collections/collections.ts b/server/routes/api/collections/collections.ts index 23465f3973..90a9c259f2 100644 --- a/server/routes/api/collections/collections.ts +++ b/server/routes/api/collections/collections.ts @@ -710,19 +710,13 @@ router.post( } await collection.save({ transaction }); - await Event.createFromContext( - ctx, - { - name: "collections.update", - collectionId: collection.id, - data: { - name, - }, + await Event.createFromContext(ctx, { + name: "collections.update", + collectionId: collection.id, + data: { + name, }, - { - transaction, - } - ); + }); if (privacyChanged || sharingChanged) { await Event.createFromContext(ctx, { diff --git a/server/routes/api/comments/comments.ts b/server/routes/api/comments/comments.ts index d81875e4b4..fc826d434e 100644 --- a/server/routes/api/comments/comments.ts +++ b/server/routes/api/comments/comments.ts @@ -390,18 +390,14 @@ router.post( }); if (created) { - await Event.createFromContext( - ctx, - { - name: "comments.add_reaction", - modelId: comment.id, - documentId: comment.documentId, - data: { - emoji, - }, + await Event.createFromContext(ctx, { + name: "comments.add_reaction", + modelId: comment.id, + documentId: comment.documentId, + data: { + emoji, }, - { transaction } - ); + }); } ctx.body = { @@ -446,18 +442,14 @@ router.post( await reaction.destroy({ transaction }); - await Event.createFromContext( - ctx, - { - name: "comments.remove_reaction", - modelId: comment.id, - documentId: comment.documentId, - data: { - emoji, - }, + await Event.createFromContext(ctx, { + name: "comments.remove_reaction", + modelId: comment.id, + documentId: comment.documentId, + data: { + emoji, }, - { transaction } - ); + }); ctx.body = { success: true, diff --git a/server/routes/api/integrations/integrations.ts b/server/routes/api/integrations/integrations.ts index e57ad6aedc..8e51099963 100644 --- a/server/routes/api/integrations/integrations.ts +++ b/server/routes/api/integrations/integrations.ts @@ -163,14 +163,10 @@ router.post( await integration.destroy({ transaction }); - await Event.createFromContext( - ctx, - { - name: "integrations.delete", - modelId: integration.id, - }, - { transaction } - ); + await Event.createFromContext(ctx, { + name: "integrations.delete", + modelId: integration.id, + }); ctx.body = { success: true,