fix(federation): add participants array to relay events and fix recipient resolution
The relay was failing because processCreateEvent relied on the friends table to discover the DM recipient, but friendships aren't federated across instances. Also, resolveLocalUser matched deleted replicated users before active ones. - Add participants[] to FederationRelayEvent with homeUserId/homeInstance for all DM channel members - Add getDmParticipants() helper to look up member identities - Include participants in outbox payloads (create/update) and sync events - Rewrite processCreateEvent to resolve participants directly, compute canonicalDmPairId, and findOrCreateDmChannel — removing the entire friends-list fallback (60+ lines) - Fix resolveLocalUser to filter out deleted users (is_deleted = 0) and prefer the replicated user match when multiple candidates exist
This commit is contained in:
@@ -172,6 +172,7 @@ async function processOutboxTick(): Promise<void> {
|
||||
messageId: entry.messageId,
|
||||
encryptionVersion: (entry.encryptionVersion ?? 0) as 0,
|
||||
timestamp: entry.createdAt,
|
||||
...(parsed.participants ? { participants: parsed.participants } : {}),
|
||||
...(parsed.message ? { message: parsed.message } : {}),
|
||||
...(parsed.reactions ? { reactions: parsed.reactions } : {}),
|
||||
...(parsed.reaction ? { reaction: parsed.reaction } : {}),
|
||||
|
||||
Reference in New Issue
Block a user