feat(federation): handle group DM messages via federatedId lookup in relay processor

In processCreateEvent, branch on event.federatedId: group DM messages now
look up the pre-bootstrapped local channel by federatedId instead of
computing a pair hash from two participants. In queueDmRelay, fetch the
channel's federatedId and ownerId and include federatedId in the outgoing
relay payload for group DMs so receiving instances can route correctly.
This commit is contained in:
Jannis Braun
2026-03-26 20:26:23 +01:00
parent 242004e8ee
commit f7ba391678
2 changed files with 42 additions and 10 deletions
@@ -318,8 +318,17 @@ export function queueDmRelay(
const targetOrigins = getGroupDmTargetOrigins(dmChannelId);
// Fetch channel to check if it's a group DM with a federatedId
const db = getDb();
const channel = db
.select({ federatedId: schema.dmChannels.federatedId, ownerId: schema.dmChannels.ownerId })
.from(schema.dmChannels)
.where(eq(schema.dmChannels.id, dmChannelId))
.get();
appendMutationLog(message.id, dmChannelId, eventType);
queueOutboxEvent(message.id, dmChannelId, eventType, JSON.stringify({
...(channel?.federatedId && channel.ownerId ? { federatedId: channel.federatedId } : {}),
message: {
...buildRelayPayload(message, message.user),
attachments: attachments.length > 0 ? attachments : undefined,