Skip to content

Commit

Permalink
hotfix (#1618)
Browse files Browse the repository at this point in the history
* refactor(classroom): add down stage all

* ci(ci): update ci build branch

* refactor(classroom): only show down stage all button on creator side

* refactor(project): edit feedback link (#1587)

* fix(classroom): disable camera and mic on down stage

* chore(version): upgrade version to v1.8.3

Co-authored-by: CRIMX <[email protected]>
Co-authored-by: hyrious <[email protected]>
  • Loading branch information
3 people authored Jul 29, 2022
1 parent ef012df commit de42b3c
Show file tree
Hide file tree
Showing 24 changed files with 212 additions and 39 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-web-dev-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- "main"
- "big-classroom-hand-raise"
paths:
- "config/**"
- "web/flat-web/**"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-web-dev-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- "main"
- "big-classroom-hand-raise"
paths:
- "config/**"
- "web/flat-web/**"
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [1.8.3](https://github.com/netless-io/flat/compare/v1.8.2...v1.8.3) (2022-07-29)


### Bug Fixes

* **classroom:** disable camera and mic on down stage ([1fc82c3](https://github.com/netless-io/flat/commit/1fc82c3b362de9452e936d2ff6122889eb2caea1))
* **whiteboard:** don't set state when not writable ([#1607](https://github.com/netless-io/flat/issues/1607)) ([#1616](https://github.com/netless-io/flat/issues/1616)) ([ef012df](https://github.com/netless-io/flat/commit/ef012df48d70f80c9f3f0ddc7df28083aa73c04c))



## [1.8.2](https://github.com/netless-io/flat/compare/v1.8.1...v1.8.2) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion desktop/main-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flat",
"productName": "Flat",
"version": "1.8.2",
"version": "1.8.3",
"private": true,
"description": "",
"homepage": "https://github.com/netless-io/flat",
Expand Down
3 changes: 3 additions & 0 deletions desktop/renderer-app/src/api-middleware/rtm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export enum RTMessageType {
AcceptRaiseHand = "AcceptRaiseHand",
/** creator cancel all hand raising */
CancelAllHandRaising = "CancelHandRaising",
/** Cancel all hand raising and whiteboard writable */
AllOffStage = "AllOffStage",
/** creator ban all rtm */
BanText = "BanText",
/** creator allows a joiner or joiners allows themselves to speak */
Expand Down Expand Up @@ -94,6 +96,7 @@ export type RTMEvents = {
[RTMessageType.RaiseHand]: boolean;
[RTMessageType.AcceptRaiseHand]: { userUUID: string; accept: boolean };
[RTMessageType.CancelAllHandRaising]: boolean;
[RTMessageType.AllOffStage]: boolean;
[RTMessageType.BanText]: boolean;
[RTMessageType.Speak]: Array<{ userUUID: string; speak: boolean }>;
[RTMessageType.DeviceState]: { userUUID: string; camera: boolean; mic: boolean };
Expand Down
5 changes: 4 additions & 1 deletion desktop/renderer-app/src/components/ChatPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { generateAvatar } from "../../utils/generate-avatar";

export interface ChatPanelProps {
classRoomStore: ClassRoomStore;
isShowAllOfStage?: boolean;
disableMultipleSpeakers?: boolean;
}

export const ChatPanel = observer<ChatPanelProps>(function ChatPanel({
classRoomStore,
isShowAllOfStage,
disableMultipleSpeakers,
}) {
const users = useComputed(() => {
Expand All @@ -28,6 +30,7 @@ export const ChatPanel = observer<ChatPanelProps>(function ChatPanel({
hasSpeaking={classRoomStore.users.speakingJoiners.length > 0}
isBan={classRoomStore.isBan}
isCreator={classRoomStore.isCreator}
isShowAllOfStage={isShowAllOfStage}
loadMoreRows={classRoomStore.updateHistory}
messages={classRoomStore.messages}
openCloudStorage={() => classRoomStore.toggleCloudStoragePanel(true)}
Expand All @@ -42,8 +45,8 @@ export const ChatPanel = observer<ChatPanelProps>(function ChatPanel({
}
classRoomStore.acceptRaiseHand(userUUID);
}}
onAllOffStage={classRoomStore.onAllOffStage}
onBanChange={classRoomStore.onToggleBan}
onCancelAllHandRaising={classRoomStore.onCancelAllHandRaising}
onEndSpeaking={userUUID => {
void classRoomStore.onSpeak([{ userUUID, speak: false }]);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export const MainPageLayoutContainer = observer<MainPageLayoutContainerProps>(
key: "feedback",
icon: (): React.ReactNode => <SVGFeedback />,
title: t("feedback"),
route: "https://github.com/netless-io/flat/issues",
route:
process.env.FLAT_REGION === "CN"
? "https://www.yuque.com/leooel/ec1kmm/vmsolg"
: "https://join.slack.com/t/agoraflat/shared_invite/zt-vdb09pf6-mD4hB7sDA4LXN2O5dhmEPQ",
},
{
key: "logout",
Expand Down
20 changes: 11 additions & 9 deletions desktop/renderer-app/src/components/Whiteboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,17 @@ export const Whiteboard = observer<WhiteboardProps>(function Whiteboard({
onDragOver={onDragOver}
onDrop={onDrop}
>
{!whiteboardStore.isCreator && !whiteboardStore.isWritable && (
<div className="raise-hand-container">
<RaiseHand
disableHandRaising={disableHandRaising}
isRaiseHand={classRoomStore.users.currentUser?.isRaiseHand}
onRaiseHandChange={classRoomStore.onToggleHandRaising}
/>
</div>
)}
{!whiteboardStore.isCreator &&
!whiteboardStore.isWritable &&
!classRoomStore.isBan && (
<div className="raise-hand-container">
<RaiseHand
disableHandRaising={disableHandRaising}
isRaiseHand={classRoomStore.users.currentUser?.isRaiseHand}
onRaiseHandChange={classRoomStore.onToggleHandRaising}
/>
</div>
)}
<div ref={bindCollector} />
<Fastboard
app={fastboardAPP}
Expand Down
1 change: 1 addition & 0 deletions desktop/renderer-app/src/pages/BigClassPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ export const BigClassPage = observer<BigClassPageProps>(function BigClassPage()
<ChatPanel
classRoomStore={classRoomStore}
disableMultipleSpeakers={true}
isShowAllOfStage={classRoomStore.isCreator}
></ChatPanel>
}
isShow={isRealtimeSideOpen}
Expand Down
49 changes: 49 additions & 0 deletions desktop/renderer-app/src/stores/class-room-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,18 @@ export class ClassRoomStore {
}
};

public onAllOffStage = (): void => {
if (this.isCreator) {
this.allOffStage();
void message.info(i18next.t("all-off-stage-toast"));
void this.rtm.sendCommand({
type: RTMessageType.AllOffStage,
value: true,
keepHistory: true,
});
}
};

/** When current user (who is a joiner) raises hand */
public onToggleHandRaising = (): void => {
if (this.isCreator || this.users.currentUser?.isSpeak) {
Expand Down Expand Up @@ -808,6 +820,34 @@ export class ClassRoomStore {
});
}

private allOffStage(): void {
if (!this.isCreator) {
this.whiteboardStore.updateWritable(false);
// guard code
if (this.whiteboardStore.room) {
if (this.whiteboardStore.isWritable !== this.whiteboardStore.room.isWritable) {
this.whiteboardStore.room.setWritable(false);
}
}
}
this.users.updateUsers(user => {
if (user.userUUID !== this.ownerUUID) {
if (user.isRaiseHand) {
user.isRaiseHand = false;
}
if (user.isSpeak) {
user.isSpeak = false;
}
if (user.camera) {
user.camera = false;
}
if (user.mic) {
user.mic = false;
}
}
});
}

private startListenCommands = (): void => {
this.rtm.on(RTMessageType.ChannelMessage, (text, senderId) => {
if (!this.isBan || senderId === this.ownerUUID) {
Expand All @@ -825,6 +865,12 @@ export class ClassRoomStore {
}
});

this.rtm.on(RTMessageType.AllOffStage, (_value, senderId) => {
if (senderId === this.ownerUUID && !this.isCreator) {
this.allOffStage();
}
});

this.rtm.on(RTMessageType.RaiseHand, (isRaiseHand, senderId) => {
this.users.updateUsers(user => {
if (user.userUUID === senderId && (!isRaiseHand || !user.isSpeak)) {
Expand Down Expand Up @@ -1077,6 +1123,9 @@ export class ClassRoomStore {

private updateBanStatus = (isBan: boolean): void => {
this.isBan = isBan;
if (isBan) {
this.allOffStage();
}
};

private updateRoomStatusLoading = (loading: RoomStatusLoadingType): void => {
Expand Down
5 changes: 5 additions & 0 deletions desktop/renderer-app/src/stores/whiteboard-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export class WhiteboardStore {

public updatePhase = (phase: RoomPhase): void => {
this.phase = phase;
if (phase === RoomPhase.Connected) {
if (this.room && this.room.isWritable !== this.isWritable) {
this.room.setWritable(this.isWritable);
}
}
};

public updateViewMode = (viewMode: ViewMode): void => {
Expand Down
8 changes: 8 additions & 0 deletions docs/releases/v1.8.3/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Improved

1. User rights management for large classes
2. User feedback process

## Fixed

1. The room created by the mobile side cannot be joined by the PC side
8 changes: 8 additions & 0 deletions docs/releases/v1.8.3/zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## 优化

1. 大班课用户权限管理
2. 用户反馈流程

## 修复

1. 卓面端无法加入移动端创建的房间
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import { User } from "../../../types/user";
export type ChatUsersProps = {
isCreator: boolean;
hasHandRaising: boolean;
isShowAllOfStage?: boolean;
hasSpeaking: boolean;
users: User[];
onCancelAllHandRaising: () => void;
onAllOffStage: () => void;
} & Omit<ChatUserProps, "user">;

export const ChatUsers = observer<ChatUsersProps>(function ChatUsers({
isCreator,
hasHandRaising,
isShowAllOfStage,
hasSpeaking,
users,
onCancelAllHandRaising,
onAllOffStage,
...restProps
}) {
const { t } = useTranslation();
Expand All @@ -48,20 +48,18 @@ export const ChatUsers = observer<ChatUsersProps>(function ChatUsers({
);
};

const isShowCancelAllHandRaising = isCreator && hasHandRaising;

return (
<div className={classNames("chat-users-wrap", { "has-speaking": hasSpeaking })}>
{isShowCancelAllHandRaising && (
{isShowAllOfStage && (
<div className="chat-users-cancel-hands-wrap">
<button className="chat-users-cancel-hands" onClick={onCancelAllHandRaising}>
{t("cancel-hand-raising")}
<button className="chat-users-cancel-hands" onClick={onAllOffStage}>
{t("all-off-stage")}
</button>
</div>
)}
<div
className={classNames("chat-users", {
"with-cancel-hands": isShowCancelAllHandRaising,
"with-cancel-hands": isShowAllOfStage,
})}
>
<AutoSizer>{renderList}</AutoSizer>
Expand Down
6 changes: 4 additions & 2 deletions packages/flat-i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"upload-success": "Successful",
"agree": "agree",
"all-staff-are-under-ban": "All members are mute",
"ban": "Mute",
"ban": "Mute All",
"banned": "Muted",
"cancel-hand-raising": "Cancel raise of hand",
"during-the-presentation": "(Speaking)",
Expand Down Expand Up @@ -468,5 +468,7 @@
"unbind-success": "Unbind success",
"delete-account": "Delete Account",
"confirm-delete-account": "Are you sure to delete your account?",
"quit-all-rooms-before-delete-account": "Please quit all rooms before deleting account."
"quit-all-rooms-before-delete-account": "Please quit all rooms before deleting account.",
"all-off-stage": "Down Stage All",
"all-off-stage-toast": "All users are down stage"
}
10 changes: 6 additions & 4 deletions packages/flat-i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"upload-exception": "上传异常",
"upload-fail": "上传失败",
"upload-success": "上传成功",
"banned": "已禁言",
"unban": "已解除禁言",
"banned": "已禁止学生聊天和举手",
"unban": "允许学生聊天和举手",
"say-something": "说点什么…",
"ban": "禁言",
"ban": "全体禁言",
"raise-your-hand": "举手",
"all-staff-are-under-ban": "全员禁言中",
"send": "发送",
Expand Down Expand Up @@ -468,5 +468,7 @@
"unbind-success": "解绑成功",
"delete-account": "账号注销",
"confirm-delete-account": "确定注销账号吗?",
"quit-all-rooms-before-delete-account": "请先退出所有房间"
"quit-all-rooms-before-delete-account": "请先退出所有房间",
"all-off-stage": "全体下台",
"all-off-stage-toast": "全体学生已下台"
}
3 changes: 3 additions & 0 deletions web/flat-web/src/api-middleware/Rtm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export enum RTMessageType {
AcceptRaiseHand = "AcceptRaiseHand",
/** creator cancel all hand raising */
CancelAllHandRaising = "CancelHandRaising",
/** Cancel all hand raising and whiteboard writable */
AllOffStage = "AllOffStage",
/** creator ban all rtm */
BanText = "BanText",
/** creator allows a joiner or joiners allows themselves to speak */
Expand Down Expand Up @@ -94,6 +96,7 @@ export type RTMEvents = {
[RTMessageType.RaiseHand]: boolean;
[RTMessageType.AcceptRaiseHand]: { userUUID: string; accept: boolean };
[RTMessageType.CancelAllHandRaising]: boolean;
[RTMessageType.AllOffStage]: boolean;
[RTMessageType.BanText]: boolean;
[RTMessageType.Speak]: Array<{ userUUID: string; speak: boolean }>;
[RTMessageType.DeviceState]: { userUUID: string; camera: boolean; mic: boolean };
Expand Down
5 changes: 4 additions & 1 deletion web/flat-web/src/components/ChatPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { generateAvatar } from "../../utils/generate-avatar";

export interface ChatPanelProps {
classRoomStore: ClassRoomStore;
isShowAllOfStage?: boolean;
disableMultipleSpeakers?: boolean;
}

export const ChatPanel = observer<ChatPanelProps>(function ChatPanel({
classRoomStore,
disableMultipleSpeakers,
isShowAllOfStage,
}) {
const users = useComputed(() => {
const { creator, speakingJoiners, handRaisingJoiners, otherJoiners } = classRoomStore.users;
Expand All @@ -28,6 +30,7 @@ export const ChatPanel = observer<ChatPanelProps>(function ChatPanel({
hasSpeaking={classRoomStore.users.speakingJoiners.length > 0}
isBan={classRoomStore.isBan}
isCreator={classRoomStore.isCreator}
isShowAllOfStage={isShowAllOfStage}
loadMoreRows={classRoomStore.updateHistory}
messages={classRoomStore.messages}
openCloudStorage={() => classRoomStore.toggleCloudStoragePanel(true)}
Expand All @@ -42,8 +45,8 @@ export const ChatPanel = observer<ChatPanelProps>(function ChatPanel({
}
classRoomStore.acceptRaiseHand(userUUID);
}}
onAllOffStage={classRoomStore.onAllOffStage}
onBanChange={classRoomStore.onToggleBan}
onCancelAllHandRaising={classRoomStore.onCancelAllHandRaising}
onEndSpeaking={userUUID => {
void classRoomStore.onSpeak([{ userUUID, speak: false }]);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export const MainPageLayoutHorizontalContainer = observer<MainPageLayoutHorizont
key: "feedback",
icon: (): React.ReactNode => <SVGFeedback />,
title: t("feedback"),
route: "https://github.com/netless-io/flat/issues",
route:
process.env.FLAT_REGION === "CN"
? "https://www.yuque.com/leooel/ec1kmm/vmsolg"
: "https://join.slack.com/t/agoraflat/shared_invite/zt-vdb09pf6-mD4hB7sDA4LXN2O5dhmEPQ",
},
{
key: "logout",
Expand Down
Loading

0 comments on commit de42b3c

Please sign in to comment.