From e50ec75cd03b7f0925053c308153bc2766a0904e Mon Sep 17 00:00:00 2001 From: neo773 <62795688+neo773@users.noreply.github.com> Date: Tue, 16 Jun 2026 22:18:06 +0530 Subject: [PATCH] fix(server): default timeline thread visibility to METADATA (#21669) Orphaned messageChannelMessageAssociation rows (channel deleted in core, association left behind when cleanup cron was down) made visibility unresolvable, so formatThreads emitted null for the non-nullable TimelineThread.visibility field and 500'd the whole timeline query. Fail closed to METADATA (most restrictive existing tier) so a missing channel hides subject/body instead of breaking the page. /closes TWENTY-SERVER-FM6 Review in cubic --- .../core-modules/messaging/utils/format-threads.util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/twenty-server/src/engine/core-modules/messaging/utils/format-threads.util.ts b/packages/twenty-server/src/engine/core-modules/messaging/utils/format-threads.util.ts index c6cf0aedc6..f75d7d71df 100644 --- a/packages/twenty-server/src/engine/core-modules/messaging/utils/format-threads.util.ts +++ b/packages/twenty-server/src/engine/core-modules/messaging/utils/format-threads.util.ts @@ -25,7 +25,9 @@ export const formatThreads = ( return threads .filter((thread) => isDefined(threadParticipantsByThreadId[thread.id])) .map((thread) => { - const visibility = threadVisibilityByThreadId[thread.id]; + const visibility = + threadVisibilityByThreadId[thread.id] ?? + MessageChannelVisibility.METADATA; return { ...thread,