From 6d15b05b8640cb39bd73b5fbf106ed0a7f656f0b Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Thu, 16 Mar 2023 10:54:54 +0100 Subject: [PATCH] Fix wrong E2E icon in room header for unencrypted local room (#10394) --- src/components/structures/RoomView.tsx | 11 ++++++----- .../structures/__snapshots__/RoomView-test.tsx.snap | 9 --------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index bc533a137f..68f64aa622 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -301,7 +301,7 @@ function LocalRoomView(props: LocalRoomViewProps): ReactElement { onSearchClick={null} onInviteClick={null} onForgetClick={null} - e2eStatus={E2EStatus.Normal} + e2eStatus={room.encrypted ? E2EStatus.Normal : undefined} onAppsClick={null} appsShown={false} excludedRightPanelPhaseButtons={[]} @@ -327,6 +327,7 @@ function LocalRoomView(props: LocalRoomViewProps): ReactElement { } interface ILocalRoomCreateLoaderProps { + localRoom: LocalRoom; names: string; resizeNotifier: ResizeNotifier; } @@ -350,7 +351,7 @@ function LocalRoomCreateLoader(props: ILocalRoomCreateLoaderProps): ReactElement onSearchClick={null} onInviteClick={null} onForgetClick={null} - e2eStatus={E2EStatus.Normal} + e2eStatus={props.localRoom.encrypted ? E2EStatus.Normal : undefined} onAppsClick={null} appsShown={false} excludedRightPanelPhaseButtons={[]} @@ -1918,11 +1919,11 @@ export class RoomView extends React.Component { return this.getPermalinkCreatorForRoom(this.state.room); } - private renderLocalRoomCreateLoader(): ReactElement { + private renderLocalRoomCreateLoader(localRoom: LocalRoom): ReactElement { const names = this.state.room.getDefaultRoomName(this.context.client.getUserId()); return ( - + ); } @@ -1956,7 +1957,7 @@ export class RoomView extends React.Component { public render(): React.ReactNode { if (this.state.room instanceof LocalRoom) { if (this.state.room.state === LocalRoomState.CREATING) { - return this.renderLocalRoomCreateLoader(); + return this.renderLocalRoomCreateLoader(this.state.room); } return this.renderLocalRoomView(this.state.room); diff --git a/test/components/structures/__snapshots__/RoomView-test.tsx.snap b/test/components/structures/__snapshots__/RoomView-test.tsx.snap index d9e3f08a52..4399ff471f 100644 --- a/test/components/structures/__snapshots__/RoomView-test.tsx.snap +++ b/test/components/structures/__snapshots__/RoomView-test.tsx.snap @@ -39,9 +39,6 @@ exports[`RoomView for a local room in state CREATING should match the snapshot 1 -
@@ -136,9 +133,6 @@ exports[`RoomView for a local room in state ERROR should match the snapshot 1`]
-
@@ -329,9 +323,6 @@ exports[`RoomView for a local room in state NEW should match the snapshot 1`] =
-