The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Only create missing webhook subscriptions for syncing channels (#26573)
neo7734c28e34f094e
diff --git a/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.ts b/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.tsindex ed46841a35e..8ba341185ab 100644--- a/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.ts+++ b/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.ts@@ -3,7 +3,9 @@ import { InjectRepository } from '@nestjs/typeorm';import {CalendarChannelSyncStage,+ CalendarChannelSyncStatus,MessageChannelSyncStage,+ MessageChannelSyncStatus,WebhookSubscriptionChannelType,WebhookSubscriptionStatus,} from 'twenty-shared/types';@@ -189,7 +191,13 @@ export class WebhookSubscriptionRenewalCronJob {private findMessageChannelsMissingSubscription(activeWorkspaceIds: string[],): Promise<StaleChannel[]> {- const scope = this.buildStaleChannelScope(activeWorkspaceIds);+ const scope = {+ ...this.buildStaleChannelScope(activeWorkspaceIds),+ syncStatus: In([+ MessageChannelSyncStatus.ACTIVE,+ MessageChannelSyncStatus.ONGOING,+ ]),+ };return this.messageChannelRepository.find({where: [@@ -219,7 +227,13 @@ export class WebhookSubscriptionRenewalCronJob {private findCalendarChannelsMissingSubscription(activeWorkspaceIds: string[],): Promise<StaleChannel[]> {- const scope = this.buildStaleChannelScope(activeWorkspaceIds);+ const scope = {+ ...this.buildStaleChannelScope(activeWorkspaceIds),+ syncStatus: In([+ CalendarChannelSyncStatus.ACTIVE,+ CalendarChannelSyncStatus.ONGOING,+ ]),+ };return this.calendarChannelRepository.find({where: [