);
diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts
index a9f37011..e9f8a35c 100644
--- a/src/matrix-utils.ts
+++ b/src/matrix-utils.ts
@@ -345,10 +345,14 @@ export async function createRoom(
* @param password
* @returns
*/
-export function getRoomUrl(roomId: string, password?: string): string {
- return `${window.location.protocol}//${
- window.location.host
- }/room/#?roomId=${roomId}${password ? "&" + PASSWORD_STRING + password : ""}`;
+export function getRoomUrl(
+ roomId: string,
+ roomName?: string,
+ password?: string
+): string {
+ return `${window.location.protocol}//${window.location.host}/#${
+ roomName ? "/" + roomAliasLocalpartFromRoomName(roomName) : ""
+ }?roomId=${roomId}${password ? "&" + PASSWORD_STRING + password : ""}`;
}
export function getAvatarUrl(
diff --git a/src/room/AppSelectionModal.tsx b/src/room/AppSelectionModal.tsx
index b1cc4e48..ec639a39 100644
--- a/src/room/AppSelectionModal.tsx
+++ b/src/room/AppSelectionModal.tsx
@@ -45,10 +45,14 @@ export const AppSelectionModal: FC = ({ roomId }) => {
const roomSharedKey = useRoomSharedKey(roomId ?? "");
const appUrl = useMemo(() => {
// 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
+ // started a client and synced to get the room details. We could take the one
+ // 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 === null
? window.location.href
- : getRoomUrl(roomId, roomSharedKey ?? undefined)
+ : getRoomUrl(roomId, undefined, roomSharedKey ?? undefined)
);
// Edit the URL to prevent the app selection prompt from appearing a second
// time within the app, and to keep the user confined to the current room
diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx
index a9db1bb7..809bba7d 100644
--- a/src/room/GroupCallView.tsx
+++ b/src/room/GroupCallView.tsx
@@ -302,7 +302,7 @@ export function GroupCallView({
const shareModal = (
diff --git a/src/room/ShareModal.tsx b/src/room/ShareModal.tsx
index b9adc8e0..1e140c3f 100644
--- a/src/room/ShareModal.tsx
+++ b/src/room/ShareModal.tsx
@@ -16,6 +16,7 @@ limitations under the License.
import { FC } from "react";
import { useTranslation } from "react-i18next";
+import { Room } from "matrix-js-sdk";
import { Modal } from "../Modal";
import { CopyButton } from "../button";
@@ -24,21 +25,21 @@ import styles from "./ShareModal.module.css";
import { useRoomSharedKey } from "../e2ee/sharedKeyManagement";
interface Props {
- roomId: string;
+ room: Room;
open: boolean;
onDismiss: () => void;
}
-export const ShareModal: FC = ({ roomId, open, onDismiss }) => {
+export const ShareModal: FC = ({ room, open, onDismiss }) => {
const { t } = useTranslation();
- const roomSharedKey = useRoomSharedKey(roomId);
+ const roomSharedKey = useRoomSharedKey(room.roomId);
return (