fix: federation relay for group DMs — origin normalization, missing federatedId, local-only broadcasts

Three stacked bugs prevented federation relay from working for group DMs:

1. Origin format mismatch: users.home_instance stores bare domains
   ("nova.ddns.net") but federation_peers.origin stores full URLs
   ("https://nova.ddns.net"). getGroupDmTargetOrigins() built target
   lists from bare domains, so queueOutboxEvent() never matched any
   peers — events were never queued into the outbox.

2. Missing federatedId in outbox reconstruction: the outbox worker
   rebuilt relay events from stored payloads but never copied the
   federatedId field. Receiving instances check this field and rejected
   all member_add/remove/ownership_transfer events with
   "missing_membership_payload".

3. Duplicate channels from cross-instance broadcasts: dm_channel_created
   was sent to ALL members including remote replicas. Users connected to
   multiple instances received the event twice (once per instance),
   creating duplicate group DMs in their sidebar. Fixed by only
   broadcasting to members whose home instance matches the current
   server — remote members receive the channel via federation bootstrap
   on their home instance.
This commit is contained in:
Jannis Braun
2026-03-27 16:53:35 +01:00
parent 04c665e0f7
commit 44b6317c16
4 changed files with 40 additions and 12 deletions
@@ -171,6 +171,7 @@ async function processOutboxTick(): Promise<void> {
timestamp: entry.createdAt,
};
if (isDm && entry.contextId) evt.dmChannelId = entry.contextId;
if (parsed.federatedId) evt.federatedId = parsed.federatedId;
if (parsed.participants) evt.participants = parsed.participants;
if (parsed.message) evt.message = parsed.message;
if (parsed.reactions) evt.reactions = parsed.reactions;