Merge pull request #1303 from robintown/copy-alias

Make the copy link buttons prefer aliases to room IDs
This commit is contained in:
Robin 2023-07-26 10:55:09 -04:00 committed by GitHub
commit 075dfaf372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 5 deletions

View File

@ -93,6 +93,7 @@ export function GroupCallView({
avatarUrl: avatarUrl!,
roomId: groupCall.room.roomId,
roomName: groupCall.room.name,
roomAlias: groupCall.room.getCanonicalAlias(),
};
}, [displayName, avatarUrl, groupCall]);

View File

@ -467,7 +467,12 @@ export function InCallView({
/>
)}
{inviteModalState.isOpen && (
<InviteModal roomId={groupCall.room.roomId} {...inviteModalProps} />
<InviteModal
roomIdOrAlias={
groupCall.room.getCanonicalAlias() ?? groupCall.room.roomId
}
{...inviteModalProps}
/>
)}
</div>
);

View File

@ -23,10 +23,10 @@ import { getRoomUrl } from "../matrix-utils";
import styles from "./InviteModal.module.css";
interface Props extends Omit<ModalProps, "title" | "children"> {
roomId: string;
roomIdOrAlias: string;
}
export const InviteModal: FC<Props> = ({ roomId, ...rest }) => {
export const InviteModal: FC<Props> = ({ roomIdOrAlias, ...rest }) => {
const { t } = useTranslation();
return (
@ -40,7 +40,7 @@ export const InviteModal: FC<Props> = ({ roomId, ...rest }) => {
<p>{t("Copy and share this call link")}</p>
<CopyButton
className={styles.copyButton}
value={getRoomUrl(roomId)}
value={getRoomUrl(roomIdOrAlias)}
data-testid="modal_inviteLink"
/>
</ModalContent>

View File

@ -112,7 +112,9 @@ export function LobbyView(props: Props) {
<Body>Or</Body>
<CopyButton
variant="secondaryCopy"
value={getRoomUrl(props.matrixInfo.roomId)}
value={getRoomUrl(
props.matrixInfo.roomAlias ?? props.matrixInfo.roomId
)}
className={styles.copyButton}
copiedMessage={t("Call link copied")}
data-testid="lobby_inviteLink"

View File

@ -36,6 +36,7 @@ export type MatrixInfo = {
avatarUrl: string;
roomId: string;
roomName: string;
roomAlias: string | null;
};
interface Props {