Skip to content

Commit

Permalink
Fix wrong E2E icon in room header for unencrypted local room (#10394)
Browse files Browse the repository at this point in the history
  • Loading branch information
weeman1337 committed Mar 16, 2023
1 parent 2344eaa commit 6d15b05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
11 changes: 6 additions & 5 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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={[]}
Expand All @@ -327,6 +327,7 @@ function LocalRoomView(props: LocalRoomViewProps): ReactElement {
}

interface ILocalRoomCreateLoaderProps {
localRoom: LocalRoom;
names: string;
resizeNotifier: ResizeNotifier;
}
Expand All @@ -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={[]}
Expand Down Expand Up @@ -1918,11 +1919,11 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
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 (
<RoomContext.Provider value={this.state}>
<LocalRoomCreateLoader names={names} resizeNotifier={this.props.resizeNotifier} />
<LocalRoomCreateLoader localRoom={localRoom} names={names} resizeNotifier={this.props.resizeNotifier} />
</RoomContext.Provider>
);
}
Expand Down Expand Up @@ -1956,7 +1957,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ exports[`RoomView for a local room in state CREATING should match the snapshot 1
</span>
</div>
</div>
<div
class="mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon"
/>
<div
class="mx_RoomHeader_name mx_RoomHeader_name--textonly"
>
Expand Down Expand Up @@ -136,9 +133,6 @@ exports[`RoomView for a local room in state ERROR should match the snapshot 1`]
</span>
</div>
</div>
<div
class="mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon"
/>
<div
class="mx_RoomHeader_name mx_RoomHeader_name--textonly"
>
Expand Down Expand Up @@ -329,9 +323,6 @@ exports[`RoomView for a local room in state NEW should match the snapshot 1`] =
</span>
</div>
</div>
<div
class="mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon"
/>
<div
class="mx_RoomHeader_name mx_RoomHeader_name--textonly"
>
Expand Down

0 comments on commit 6d15b05

Please sign in to comment.