Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(flat-pages): room not begin modal wrong logic #2116

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/flat-i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 1 addition & 2 deletions packages/flat-i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
20 changes: 7 additions & 13 deletions packages/flat-pages/src/utils/join-room-handler.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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);
Expand Down
Loading