mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
chore(server): ignore erorr when join joint room (#10354)
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user