From dedf6eca3f6abd67ae77a2ffdda56c791b9dcca8 Mon Sep 17 00:00:00 2001 From: hyrious Date: Tue, 20 Feb 2024 17:35:36 +0800 Subject: [PATCH] fix(flat-pages): room not begin modal wrong logic --- packages/flat-i18n/locales/en.json | 1 - packages/flat-i18n/locales/zh-CN.json | 3 +-- .../flat-pages/src/utils/join-room-handler.ts | 20 +++++++------------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/packages/flat-i18n/locales/en.json b/packages/flat-i18n/locales/en.json index 6940da6616d..35eb172f32f 100644 --- a/packages/flat-i18n/locales/en.json +++ b/packages/flat-i18n/locales/en.json @@ -656,7 +656,6 @@ "room-not-begin-title-post": "before it starts", "room-has-been-added": "has been added to rooms list", "the-room-is-not-started-yet": "The room has not started yet, please try again later", - "your-room-is-not-started-yet": "Your room has not started yet, please try again later", "will-start-after-minutes": "will start after {{minutes}} minutes", "time-limit-tip": "This {{roomType}} room has a limit of {{minutes}} minutes", "vip-level": { diff --git a/packages/flat-i18n/locales/zh-CN.json b/packages/flat-i18n/locales/zh-CN.json index 7d9c8d56252..80f46d4798a 100644 --- a/packages/flat-i18n/locales/zh-CN.json +++ b/packages/flat-i18n/locales/zh-CN.json @@ -655,8 +655,7 @@ "minutes": "{{minutes}}分钟", "room-not-begin-title-post": "可进入", "room-has-been-added": "已加入房间列表", - "the-room-is-not-started-yet": "房间未开始,开课前 5 分钟可进入,已将该房间添加到房间列表", - "your-room-is-not-started-yet": "房间未开始,开课前 5 分钟可进入", + "the-room-is-not-started-yet": "房间未开始,开课前 5 分钟可进入", "will-start-after-minutes": "{{minutes}} 分钟后开始", "time-limit-tip": "你已加入{{roomType}} {{minutes}} 分钟限时房间", "vip-level": { diff --git a/packages/flat-pages/src/utils/join-room-handler.ts b/packages/flat-pages/src/utils/join-room-handler.ts index d884e84c077..b7477c16eec 100644 --- a/packages/flat-pages/src/utils/join-room-handler.ts +++ b/packages/flat-pages/src/utils/join-room-handler.ts @@ -1,6 +1,6 @@ import { RouteNameType } from "../utils/routes"; import { roomStore, globalStore } from "@netless/flat-stores"; -import { RequestErrorCode, RoomType, ServerRequestError } from "@netless/flat-server-api"; +import { RequestErrorCode, RoomType } from "@netless/flat-server-api"; import { errorTips, message } from "flat-components"; import { FlatI18n } from "@netless/flat-i18n"; @@ -56,24 +56,18 @@ export const joinRoomHandler = async ( return; } - // if room not started, show different message according to owner - if (e.errorCode === RequestErrorCode.RoomNotBegin && e.detail) { - const { title, ownerUUID, ownerName } = e.detail as { + // if room not started, show different tips + if (e.errorCode === RequestErrorCode.RoomNotBeginAndAddList && e.detail) { + const roomNotBegin = e.detail as { title: string; uuid: string; beginTime: number; ownerUUID: string; ownerName?: string; }; - if (globalStore.userUUID === ownerUUID) { - (e as ServerRequestError).errorMessage = "your-room-is-not-started-yet"; - // show it in error tips - } else { - pushHistory(RouteNameType.HomePage); - // show the modal - globalStore.updateRoomNotBegin({ title, ownerName }); - return; - } + pushHistory(RouteNameType.HomePage); + globalStore.updateRoomNotBegin(roomNotBegin); + return; } pushHistory(RouteNameType.HomePage);