Skip to content

Commit

Permalink
fix(flat-stores): whiteboard access tip incorrect (#2028)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious authored Aug 28, 2023
1 parent 19eaa12 commit ed43167
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
30 changes: 14 additions & 16 deletions packages/flat-stores/src/classroom-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,23 +662,21 @@ export class ClassroomStore {
for (const userUUID in diff) {
const user = this.users.cachedUsers.get(userUUID);
const enabled = diff[userUUID]?.newValue;
if (user) {
if (this.isCreator) {
if (enabled) {
message.info(
FlatI18n.t("grant-whiteboard-access", { name: user.name }),
);
} else {
message.info(
FlatI18n.t("revoke-whiteboard-access", { name: user.name }),
);
}
if (this.userUUID === userUUID) {
if (enabled) {
message.info(FlatI18n.t("granted-whiteboard-access"));
} else {
if (enabled) {
message.info(FlatI18n.t("granted-whiteboard-access"));
} else {
message.info(FlatI18n.t("revoked-whiteboard-access"));
}
message.info(FlatI18n.t("revoked-whiteboard-access"));
}
} else if (user && this.isCreator) {
if (enabled) {
message.info(
FlatI18n.t("grant-whiteboard-access", { name: user.name }),
);
} else {
message.info(
FlatI18n.t("revoke-whiteboard-access", { name: user.name }),
);
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions packages/flat-stores/src/whiteboard-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,16 @@ export class WhiteboardStore {
throw new Error("Missing Whiteboard UUID and Token");
}

const defaultRegion = globalStore.serverRegionConfig?.whiteboard.convertRegion as Region;
const isDifferentRegion = globalStore.region !== defaultRegion;
const userName = isDifferentRegion ? void 0 : globalStore.userName;

await this.whiteboard.joinRoom({
roomID: globalStore.whiteboardRoomUUID,
roomToken: globalStore.whiteboardRoomToken,
region:
globalStore.region ??
(globalStore.serverRegionConfig?.whiteboard.convertRegion as Region),
region: globalStore.region ?? defaultRegion,
uid: globalStore.userUUID,
nickName: globalStore.userInfo?.name ?? globalStore.userUUID,
nickName: userName ?? globalStore.userUUID.slice(-8),
classroomType: this.getRoomType(),
options: {
strokeTail: preferencesStore.strokeTail,
Expand Down

0 comments on commit ed43167

Please sign in to comment.