Revert "Refactor useIsRoomE2EE"

This commit is contained in:
David Baker
2023-09-22 18:20:29 +01:00
committed by GitHub
parent ef32b877ee
commit 48b038914f
4 changed files with 14 additions and 23 deletions

View File

@@ -25,10 +25,9 @@ import { useIsRoomE2EE, useRoomSharedKey } from "../e2ee/sharedKeyManagement";
import { getAbsoluteRoomUrl } from "../matrix-utils";
import styles from "./AppSelectionModal.module.css";
import { editFragmentQuery } from "../UrlParams";
import { useClient } from "../ClientContext";
interface Props {
roomId: string | undefined;
roomId: string | null;
}
export const AppSelectionModal: FC<Props> = ({ roomId }) => {
@@ -44,11 +43,8 @@ export const AppSelectionModal: FC<Props> = ({ roomId }) => {
[setOpen]
);
const { client } = useClient();
const room = useMemo(() => client?.getRoom(roomId) ?? null, [roomId, client]);
const roomSharedKey = useRoomSharedKey(roomId ?? "");
const roomIsEncrypted = useIsRoomE2EE(room ?? undefined);
const roomIsEncrypted = useIsRoomE2EE(roomId ?? "");
if (roomIsEncrypted && roomSharedKey === undefined) {
logger.error(
"Generating app redirect URL for encrypted room but don't have key available!"
@@ -62,7 +58,7 @@ export const AppSelectionModal: FC<Props> = ({ roomId }) => {
// we got in our own URL and use that, but it's not a string that a human
// ever sees so it's somewhat redundant. We just don't pass a name.
const url = new URL(
!roomId
roomId === null
? window.location.href
: getAbsoluteRoomUrl(roomId, undefined, roomSharedKey ?? undefined)
);