diff --git a/server/commands/starCreator.ts b/server/commands/starCreator.ts index 02a55bae9..cdf960b61 100644 --- a/server/commands/starCreator.ts +++ b/server/commands/starCreator.ts @@ -54,7 +54,7 @@ export default async function starCreator({ index = fractionalIndex(null, stars.length ? stars[0].index : null); } - const response = await Star.findOrCreate({ + const [star, isCreated] = await Star.findOrCreate({ where: documentId ? { userId: user.id, @@ -69,12 +69,12 @@ export default async function starCreator({ }, transaction, }); - const star = response[0]; - if (response[1]) { + if (isCreated) { await Event.create( { name: "stars.create", + teamId: user.teamId, modelId: star.id, userId: user.id, actorId: user.id, diff --git a/server/queues/processors/WebhookProcessor.ts b/server/queues/processors/WebhookProcessor.ts index cb9393b80..3f0f4f12e 100644 --- a/server/queues/processors/WebhookProcessor.ts +++ b/server/queues/processors/WebhookProcessor.ts @@ -7,6 +7,10 @@ export default class WebhookProcessor extends BaseProcessor { static applicableEvents: ["*"] = ["*"]; async perform(event: Event) { + if (!event.teamId) { + return; + } + const webhookSubscriptions = await WebhookSubscription.findAll({ where: { enabled: true,