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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user