fix: Error in WebhookProcessor when team is permanatly destroyed
This commit is contained in:
@@ -54,7 +54,7 @@ export default async function starCreator({
|
|||||||
index = fractionalIndex(null, stars.length ? stars[0].index : null);
|
index = fractionalIndex(null, stars.length ? stars[0].index : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await Star.findOrCreate({
|
const [star, isCreated] = await Star.findOrCreate({
|
||||||
where: documentId
|
where: documentId
|
||||||
? {
|
? {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
@@ -69,12 +69,12 @@ export default async function starCreator({
|
|||||||
},
|
},
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
const star = response[0];
|
|
||||||
|
|
||||||
if (response[1]) {
|
if (isCreated) {
|
||||||
await Event.create(
|
await Event.create(
|
||||||
{
|
{
|
||||||
name: "stars.create",
|
name: "stars.create",
|
||||||
|
teamId: user.teamId,
|
||||||
modelId: star.id,
|
modelId: star.id,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
actorId: user.id,
|
actorId: user.id,
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ export default class WebhookProcessor extends BaseProcessor {
|
|||||||
static applicableEvents: ["*"] = ["*"];
|
static applicableEvents: ["*"] = ["*"];
|
||||||
|
|
||||||
async perform(event: Event) {
|
async perform(event: Event) {
|
||||||
|
if (!event.teamId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const webhookSubscriptions = await WebhookSubscription.findAll({
|
const webhookSubscriptions = await WebhookSubscription.findAll({
|
||||||
where: {
|
where: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user