Files
twenty/packages
Sonarly Claude Code c52c976aca fix(calendar): add null check for connectedAccount in blocklist delete job
https://sonarly.com/issue/34944?type=bug

The BlocklistItemDeleteCalendarEventsJob crashes with a TypeError when a calendar channel's connectedAccount relation resolves to null, preventing blocklist-triggered calendar event cleanup from completing.

Fix: Added null-safe access to `calendarChannel.connectedAccount` using optional chaining (`?.`) and the existing `isDefined()` utility, matching the exact pattern already used in the equivalent messaging blocklist job (`messaging-blocklist-item-delete-messages.job.ts`).

The fix replaces the unsafe direct property access:
```typescript
if (calendarChannel.connectedAccount.handleAliases) {
```

With the null-safe pattern:
```typescript
const handleAliases = calendarChannel.connectedAccount?.handleAliases;
if (isDefined(handleAliases)) {
```

This prevents the TypeError when `connectedAccount` is null (due to deleted connected accounts or incomplete data migration from workspace schemas to the core metadata schema). When `connectedAccount` is null, the code now safely skips alias processing and proceeds with only the calendar channel's own handle for the blocklist matching.
2026-05-05 16:56:10 +00:00
..
2026-05-04 11:09:34 +02:00
2026-05-05 16:44:11 +02:00