From 1b99680b0e580ffc799f9a4188b432128ba595b5 Mon Sep 17 00:00:00 2001 From: hyrious Date: Wed, 10 May 2023 12:28:18 +0800 Subject: [PATCH] refactor(flat-stores): never delete owner info in classroom --- packages/flat-stores/src/classroom-store/index.ts | 2 +- packages/flat-stores/src/user-store.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/flat-stores/src/classroom-store/index.ts b/packages/flat-stores/src/classroom-store/index.ts index 164d8ebbe85..d404cc6fad1 100644 --- a/packages/flat-stores/src/classroom-store/index.ts +++ b/packages/flat-stores/src/classroom-store/index.ts @@ -372,7 +372,7 @@ export class ClassroomStore { const fastboard = await this.whiteboardStore.joinWhiteboardRoom(); - await this.users.initUsers([...this.rtm.members]); + await this.users.initUsers([this.ownerUUID, ...this.rtm.members]); const deviceStateStorage = fastboard.syncedStore.connectStorage( "deviceState", diff --git a/packages/flat-stores/src/user-store.ts b/packages/flat-stores/src/user-store.ts index e7ad5da79c4..017f9d41520 100644 --- a/packages/flat-stores/src/user-store.ts +++ b/packages/flat-stores/src/user-store.ts @@ -47,7 +47,7 @@ export class UserStore { public get totalUserCount(): number { return ( - (this.creator ? 1 : 0) + + (this.creator && !this.creator.hasLeft ? 1 : 0) + (this.speakingJoiners.length + this.handRaisingJoiners.length + this.otherJoiners.length) @@ -98,7 +98,8 @@ export class UserStore { public removeUser = (userUUID: string): void => { if (this.creator && this.creator.userUUID === userUUID) { this.creator.hasLeft = true; - this.creator = null; + // always show creator + // this.creator = null; } else { for (const { group } of this.joinerGroups) { for (let i = 0; i < this[group].length; i++) {