feat: lift DM gates for federated users

Remove requireLocalUser from DM routes, include DMs in federated
ready payload, replace blanket dm_* WS gate with call-only blocklist.
DM calls remain gated (separate scope).
This commit is contained in:
Jannis Braun
2026-04-07 19:48:07 +02:00
parent 9b8330fcdb
commit 662143bf08
3 changed files with 14 additions and 10 deletions
+4 -5
View File
@@ -145,11 +145,12 @@ export function handleClientEvent(
): void {
const type = event.type as string;
// Federation gating: federated users must use their home instance for DM operations
if (isFederated && type.startsWith('dm_')) {
// Federation gating: DM calls remain blocked for federated users (separate scope)
const DM_CALL_EVENTS = ['dm_call_start', 'dm_call_accept', 'dm_call_reject', 'dm_call_end'];
if (isFederated && DM_CALL_EVENTS.includes(type)) {
connectionManager.sendToUser(userId, {
type: 'error',
message: 'Federated users must use their home instance for DM operations',
message: 'Federated users cannot use DM calls on remote instances',
});
return;
}
@@ -1278,7 +1279,6 @@ function handleChannelAck(event: Record<string, unknown>, userId: string, isFede
if (spaceId) {
if (!isMember(spaceId, userId)) return;
} else {
if (isFederated) return;
if (!isDmMember(channelId, userId)) return;
}
@@ -1333,7 +1333,6 @@ function handleMarkUnread(event: Record<string, unknown>, userId: string, isFede
if (spaceId) {
if (!isMember(spaceId, userId)) return;
} else {
if (isFederated) return;
if (!isDmMember(channelId, userId)) return;
}