chore(server): ignore erorr when join joint room (#10354)

This commit is contained in:
liuyi
2025-02-21 18:48:53 +08:00
committed by GitHub
parent 64370980b3
commit 7d68aa5b2f

View File

@@ -11,7 +11,6 @@ import { ClsInterceptor } from 'nestjs-cls';
import { Socket } from 'socket.io';
import {
AlreadyInSpace,
CallMetric,
DocNotFound,
GatewayErrorWrapper,
@@ -617,13 +616,17 @@ abstract class SyncSocketAdapter {
}
async join(userId: string, spaceId: string, roomType: RoomType = 'sync') {
this.assertNotIn(spaceId, roomType);
if (this.in(spaceId, roomType)) {
return;
}
await this.assertAccessible(spaceId, userId, WorkspaceRole.Collaborator);
return this.client.join(this.room(spaceId, roomType));
}
async leave(spaceId: string, roomType: RoomType = 'sync') {
this.assertIn(spaceId, roomType);
if (!this.in(spaceId, roomType)) {
return;
}
return this.client.leave(this.room(spaceId, roomType));
}
@@ -631,12 +634,6 @@ abstract class SyncSocketAdapter {
return this.client.rooms.has(this.room(spaceId, roomType));
}
assertNotIn(spaceId: string, roomType: RoomType = 'sync') {
if (this.client.rooms.has(this.room(spaceId, roomType))) {
throw new AlreadyInSpace({ spaceId });
}
}
assertIn(spaceId: string, roomType: RoomType = 'sync') {
if (!this.client.rooms.has(this.room(spaceId, roomType))) {
throw new NotInSpace({ spaceId });