Make copy link button include a password

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2023-08-08 15:44:26 +02:00
parent 89ae0e1e62
commit 7ace81a7cc
5 changed files with 34 additions and 14 deletions

View File

@@ -462,9 +462,8 @@ export function InCallView({
)}
{inviteModalState.isOpen && (
<InviteModal
roomIdOrAlias={
groupCall.room.getCanonicalAlias() ?? groupCall.room.roomId
}
roomAlias={groupCall.room.getCanonicalAlias() ?? undefined}
roomId={groupCall.room.roomId}
{...inviteModalProps}
/>
)}

View File

@@ -1,5 +1,5 @@
/*
Copyright 2022 New Vector Ltd
Copyright 2022 - 2023 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -21,13 +21,16 @@ import { Modal, ModalContent, ModalProps } from "../Modal";
import { CopyButton } from "../button";
import { getRoomUrl } from "../matrix-utils";
import styles from "./InviteModal.module.css";
import { useRoomSharedKey } from "../e2ee/sharedKeyManagement";
interface Props extends Omit<ModalProps, "title" | "children"> {
roomIdOrAlias: string;
roomAlias?: string;
roomId: string;
}
export const InviteModal: FC<Props> = ({ roomIdOrAlias, ...rest }) => {
export const InviteModal: FC<Props> = ({ roomAlias, roomId, ...rest }) => {
const { t } = useTranslation();
const [roomSharedKey] = useRoomSharedKey(roomId);
return (
<Modal
@@ -40,7 +43,7 @@ export const InviteModal: FC<Props> = ({ roomIdOrAlias, ...rest }) => {
<p>{t("Copy and share this call link")}</p>
<CopyButton
className={styles.copyButton}
value={getRoomUrl(roomIdOrAlias)}
value={getRoomUrl(roomAlias ?? roomId, roomSharedKey)}
data-testid="modal_inviteLink"
/>
</ModalContent>

View File

@@ -26,6 +26,7 @@ import { Body, Link } from "../typography/Typography";
import { useLocationNavigation } from "../useLocationNavigation";
import { MatrixInfo, VideoPreview } from "./VideoPreview";
import { MuteStates } from "./MuteStates";
import { useRoomSharedKey } from "../e2ee/sharedKeyManagement";
interface Props {
matrixInfo: MatrixInfo;
@@ -43,6 +44,7 @@ export const LobbyView: FC<Props> = ({
hideHeader,
}) => {
const { t } = useTranslation();
const [roomSharedKey] = useRoomSharedKey(matrixInfo.roomId);
useLocationNavigation();
const joinCallButtonRef = useRef<HTMLButtonElement>(null);
@@ -80,7 +82,10 @@ export const LobbyView: FC<Props> = ({
<Body>Or</Body>
<CopyButton
variant="secondaryCopy"
value={getRoomUrl(matrixInfo.roomAlias ?? matrixInfo.roomId)}
value={getRoomUrl(
matrixInfo.roomAlias ?? matrixInfo.roomId,
roomSharedKey
)}
className={styles.copyButton}
copiedMessage={t("Call link copied")}
data-testid="lobby_inviteLink"