Log an error if we don't have the key when generating a url for en e2ee room
This commit is contained in:
@@ -18,9 +18,10 @@ import { FC, MouseEvent, useCallback, useMemo, useState } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Button, Text } from "@vector-im/compound-web";
|
import { Button, Text } from "@vector-im/compound-web";
|
||||||
import { ReactComponent as PopOutIcon } from "@vector-im/compound-design-tokens/icons/pop-out.svg";
|
import { ReactComponent as PopOutIcon } from "@vector-im/compound-design-tokens/icons/pop-out.svg";
|
||||||
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
|
|
||||||
import { Modal } from "../Modal";
|
import { Modal } from "../Modal";
|
||||||
import { useRoomSharedKey } from "../e2ee/sharedKeyManagement";
|
import { useIsRoomE2EE, useRoomSharedKey } from "../e2ee/sharedKeyManagement";
|
||||||
import { getAbsoluteRoomUrl } from "../matrix-utils";
|
import { getAbsoluteRoomUrl } from "../matrix-utils";
|
||||||
import styles from "./AppSelectionModal.module.css";
|
import styles from "./AppSelectionModal.module.css";
|
||||||
import { editFragmentQuery } from "../UrlParams";
|
import { editFragmentQuery } from "../UrlParams";
|
||||||
@@ -43,6 +44,13 @@ export const AppSelectionModal: FC<Props> = ({ roomId }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const roomSharedKey = useRoomSharedKey(roomId ?? "");
|
const roomSharedKey = useRoomSharedKey(roomId ?? "");
|
||||||
|
const roomIsEncrypted = useIsRoomE2EE(roomId ?? "");
|
||||||
|
if (roomIsEncrypted && roomSharedKey === undefined) {
|
||||||
|
logger.error(
|
||||||
|
"Generating app redirect URL for encrypted room but don't have key available!"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const appUrl = useMemo(() => {
|
const appUrl = useMemo(() => {
|
||||||
// If the room ID is not known, fall back to the URL of the current page
|
// If the room ID is not known, fall back to the URL of the current page
|
||||||
// Also, we don't really know the room name at this stage as we haven't
|
// Also, we don't really know the room name at this stage as we haven't
|
||||||
|
|||||||
Reference in New Issue
Block a user