diff --git a/packages/server/src/utils/federationOutbox.ts b/packages/server/src/utils/federationOutbox.ts index 822f1748..847fb459 100644 --- a/packages/server/src/utils/federationOutbox.ts +++ b/packages/server/src/utils/federationOutbox.ts @@ -330,21 +330,23 @@ export function getGroupDmTargetOrigins(dmChannelId: string): string[] | undefin .where(eq(schema.dmChannels.id, dmChannelId)) .get(); - // Not a group DM (no owner) — broadcast to all - if (!channel?.ownerId) return undefined; - + // Always compute target origins from participants — both 1-on-1 and group DMs. + // Returning undefined (broadcast to all) would skip the pending-placeholder creation + // in queueOutboxEvent(), preventing relay when no peer exists yet. const participants = getDmParticipants(dmChannelId); const ourOrigin = getOurOrigin(); const origins = new Set(); for (const p of participants) { - // Normalize homeInstance to full URL format to match federation_peers.origin const normalized = p.homeInstance.startsWith('http') ? p.homeInstance : `https://${p.homeInstance}`; if (normalized !== ourOrigin) { origins.add(normalized); } } + // No remote participants — no relay needed + if (origins.size === 0) return undefined; + return Array.from(origins); }