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