fix: deliver relayed DM messages to federated users on receiving instance

The relay broadcast loop skipped members whose homeInstance matched the
source instance, assuming they already received the message on their home
server. This broke delivery for federated users (e.g. youruser@nova on
orbit) who are actively connected to the remote instance.

Client-side dedup in addRealtimeMessage already handles double delivery
via sourceMessageId cross-matching, making the server-side skip both
unnecessary and harmful.
This commit is contained in:
Jannis Braun
2026-04-07 23:50:35 +02:00
parent e3742e199a
commit 2d32d9ae41
-9
View File
@@ -1940,15 +1940,6 @@ function processCreateEvent(
.all();
for (const member of dmMembers) {
const memberUser = db.select()
.from(schema.users)
.where(eq(schema.users.id, member.userId))
.get();
// Skip members whose home instance is the source — they already have this message
const memberHome = memberUser?.homeInstance?.startsWith('http') ? memberUser.homeInstance : `https://${memberUser?.homeInstance}`;
if (memberHome === sourceInstance) continue;
// If the member closed this DM, reopen it and send dm_channel_created
// so the sidebar resurfaces before the message arrives.
if (member.closed === 1) {