Remove unnecessary usage of a roomIdOrAlias
In most cases the `roomId` was used despite the name of the variable.
This commit is contained in:
@@ -70,10 +70,9 @@ export function RegisteredView({ client, isPasswordlessUser }: Props) {
|
|||||||
setError(undefined);
|
setError(undefined);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
const [roomIdOrAlias] = await createRoom(client, roomName, ptt);
|
const [roomAlias] = await createRoom(client, roomName, ptt);
|
||||||
|
if (roomAlias) {
|
||||||
if (roomIdOrAlias) {
|
history.push(`/room/${roomAlias}`);
|
||||||
history.push(`/room/${roomIdOrAlias}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ export const UnauthenticatedView: FC = () => {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
let roomIdOrAlias: string;
|
let roomAlias: string;
|
||||||
try {
|
try {
|
||||||
[roomIdOrAlias] = await createRoom(client, roomName, ptt);
|
[roomAlias] = await createRoom(client, roomName, ptt);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!setClient) {
|
if (!setClient) {
|
||||||
throw error;
|
throw error;
|
||||||
@@ -111,7 +111,7 @@ export const UnauthenticatedView: FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setClient({ client, session });
|
setClient({ client, session });
|
||||||
history.push(`/room/${roomIdOrAlias}`);
|
history.push(`/room/${roomAlias}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
submit().catch((error) => {
|
submit().catch((error) => {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { GroupCall, GroupCallState } from "matrix-js-sdk/src/webrtc/groupCall";
|
import { GroupCall, GroupCallState } from "matrix-js-sdk/src/webrtc/groupCall";
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
@@ -50,7 +50,6 @@ interface Props {
|
|||||||
isEmbedded: boolean;
|
isEmbedded: boolean;
|
||||||
preload: boolean;
|
preload: boolean;
|
||||||
hideHeader: boolean;
|
hideHeader: boolean;
|
||||||
roomIdOrAlias: string;
|
|
||||||
groupCall: GroupCall;
|
groupCall: GroupCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +59,6 @@ export function GroupCallView({
|
|||||||
isEmbedded,
|
isEmbedded,
|
||||||
preload,
|
preload,
|
||||||
hideHeader,
|
hideHeader,
|
||||||
roomIdOrAlias,
|
|
||||||
groupCall,
|
groupCall,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const {
|
const {
|
||||||
@@ -83,13 +81,14 @@ export function GroupCallView({
|
|||||||
}, [groupCall]);
|
}, [groupCall]);
|
||||||
|
|
||||||
const { displayName, avatarUrl } = useProfile(client);
|
const { displayName, avatarUrl } = useProfile(client);
|
||||||
|
const matrixInfo = useMemo((): MatrixInfo => {
|
||||||
const matrixInfo: MatrixInfo = {
|
return {
|
||||||
displayName: displayName!,
|
displayName: displayName!,
|
||||||
avatarUrl: avatarUrl!,
|
avatarUrl: avatarUrl!,
|
||||||
|
roomId: groupCall.room.roomId,
|
||||||
roomName: groupCall.room.name,
|
roomName: groupCall.room.name,
|
||||||
roomIdOrAlias,
|
|
||||||
};
|
};
|
||||||
|
}, [displayName, avatarUrl, groupCall]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (widget && preload) {
|
if (widget && preload) {
|
||||||
@@ -243,7 +242,6 @@ export function GroupCallView({
|
|||||||
onLeave={onLeave}
|
onLeave={onLeave}
|
||||||
unencryptedEventsFromUsers={unencryptedEventsFromUsers}
|
unencryptedEventsFromUsers={unencryptedEventsFromUsers}
|
||||||
hideHeader={hideHeader}
|
hideHeader={hideHeader}
|
||||||
matrixInfo={matrixInfo}
|
|
||||||
userChoices={userChoices}
|
userChoices={userChoices}
|
||||||
otelGroupCallMembership={otelGroupCallMembership}
|
otelGroupCallMembership={otelGroupCallMembership}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ import { ElementWidgetActions, widget } from "../widget";
|
|||||||
import { GridLayoutMenu } from "./GridLayoutMenu";
|
import { GridLayoutMenu } from "./GridLayoutMenu";
|
||||||
import { GroupCallInspector } from "./GroupCallInspector";
|
import { GroupCallInspector } from "./GroupCallInspector";
|
||||||
import styles from "./InCallView.module.css";
|
import styles from "./InCallView.module.css";
|
||||||
import { MatrixInfo } from "./VideoPreview";
|
|
||||||
import { useJoinRule } from "./useJoinRule";
|
import { useJoinRule } from "./useJoinRule";
|
||||||
import { ParticipantInfo } from "./useGroupCall";
|
import { ParticipantInfo } from "./useGroupCall";
|
||||||
import { ItemData, TileContent, VideoTile } from "../video-grid/VideoTile";
|
import { ItemData, TileContent, VideoTile } from "../video-grid/VideoTile";
|
||||||
@@ -118,7 +117,6 @@ export interface InCallViewProps {
|
|||||||
onLeave: () => void;
|
onLeave: () => void;
|
||||||
unencryptedEventsFromUsers: Set<string>;
|
unencryptedEventsFromUsers: Set<string>;
|
||||||
hideHeader: boolean;
|
hideHeader: boolean;
|
||||||
matrixInfo: MatrixInfo;
|
|
||||||
otelGroupCallMembership?: OTelGroupCallMembership;
|
otelGroupCallMembership?: OTelGroupCallMembership;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +128,6 @@ export function InCallView({
|
|||||||
onLeave,
|
onLeave,
|
||||||
unencryptedEventsFromUsers,
|
unencryptedEventsFromUsers,
|
||||||
hideHeader,
|
hideHeader,
|
||||||
matrixInfo,
|
|
||||||
otelGroupCallMembership,
|
otelGroupCallMembership,
|
||||||
}: InCallViewProps) {
|
}: InCallViewProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -397,7 +394,7 @@ export function InCallView({
|
|||||||
{!hideHeader && maximisedParticipant === null && (
|
{!hideHeader && maximisedParticipant === null && (
|
||||||
<Header>
|
<Header>
|
||||||
<LeftNav>
|
<LeftNav>
|
||||||
<RoomHeaderInfo roomName={matrixInfo.roomName} />
|
<RoomHeaderInfo roomName={groupCall.room.name} />
|
||||||
<VersionMismatchWarning
|
<VersionMismatchWarning
|
||||||
users={unencryptedEventsFromUsers}
|
users={unencryptedEventsFromUsers}
|
||||||
room={groupCall.room}
|
room={groupCall.room}
|
||||||
@@ -428,7 +425,7 @@ export function InCallView({
|
|||||||
{rageshakeRequestModalState.isOpen && !noControls && (
|
{rageshakeRequestModalState.isOpen && !noControls && (
|
||||||
<RageshakeRequestModal
|
<RageshakeRequestModal
|
||||||
{...rageshakeRequestModalProps}
|
{...rageshakeRequestModalProps}
|
||||||
roomIdOrAlias={matrixInfo.roomIdOrAlias}
|
roomId={groupCall.room.roomId}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{settingsModalState.isOpen && (
|
{settingsModalState.isOpen && (
|
||||||
@@ -440,10 +437,7 @@ export function InCallView({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{inviteModalState.isOpen && (
|
{inviteModalState.isOpen && (
|
||||||
<InviteModal
|
<InviteModal roomId={groupCall.room.roomId} {...inviteModalProps} />
|
||||||
roomIdOrAlias={matrixInfo.roomIdOrAlias}
|
|
||||||
{...inviteModalProps}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ import { getRoomUrl } from "../matrix-utils";
|
|||||||
import styles from "./InviteModal.module.css";
|
import styles from "./InviteModal.module.css";
|
||||||
|
|
||||||
interface Props extends Omit<ModalProps, "title" | "children"> {
|
interface Props extends Omit<ModalProps, "title" | "children"> {
|
||||||
roomIdOrAlias: string;
|
roomId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const InviteModal: FC<Props> = ({ roomIdOrAlias, ...rest }) => {
|
export const InviteModal: FC<Props> = ({ roomId, ...rest }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -40,7 +40,7 @@ export const InviteModal: FC<Props> = ({ roomIdOrAlias, ...rest }) => {
|
|||||||
<p>{t("Copy and share this call link")}</p>
|
<p>{t("Copy and share this call link")}</p>
|
||||||
<CopyButton
|
<CopyButton
|
||||||
className={styles.copyButton}
|
className={styles.copyButton}
|
||||||
value={getRoomUrl(roomIdOrAlias)}
|
value={getRoomUrl(roomId)}
|
||||||
data-testid="modal_inviteLink"
|
data-testid="modal_inviteLink"
|
||||||
/>
|
/>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export function LobbyView(props: Props) {
|
|||||||
<Body>Or</Body>
|
<Body>Or</Body>
|
||||||
<CopyButton
|
<CopyButton
|
||||||
variant="secondaryCopy"
|
variant="secondaryCopy"
|
||||||
value={getRoomUrl(props.matrixInfo.roomName)}
|
value={getRoomUrl(props.matrixInfo.roomId)}
|
||||||
className={styles.copyButton}
|
className={styles.copyButton}
|
||||||
copiedMessage={t("Call link copied")}
|
copiedMessage={t("Call link copied")}
|
||||||
data-testid="lobby_inviteLink"
|
data-testid="lobby_inviteLink"
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ import { Body } from "../typography/Typography";
|
|||||||
|
|
||||||
interface Props extends Omit<ModalProps, "title" | "children"> {
|
interface Props extends Omit<ModalProps, "title" | "children"> {
|
||||||
rageshakeRequestId: string;
|
rageshakeRequestId: string;
|
||||||
roomIdOrAlias: string;
|
roomId: string;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RageshakeRequestModal: FC<Props> = ({
|
export const RageshakeRequestModal: FC<Props> = ({
|
||||||
rageshakeRequestId,
|
rageshakeRequestId,
|
||||||
roomIdOrAlias,
|
roomId,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -57,7 +57,7 @@ export const RageshakeRequestModal: FC<Props> = ({
|
|||||||
submitRageshake({
|
submitRageshake({
|
||||||
sendLogs: true,
|
sendLogs: true,
|
||||||
rageshakeRequestId,
|
rageshakeRequestId,
|
||||||
roomId: roomIdOrAlias, // Possibly not a room ID, but oh well
|
roomId,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
disabled={sending}
|
disabled={sending}
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ export const RoomPage: FC = () => {
|
|||||||
(groupCall: GroupCall) => (
|
(groupCall: GroupCall) => (
|
||||||
<GroupCallView
|
<GroupCallView
|
||||||
client={client!}
|
client={client!}
|
||||||
roomIdOrAlias={roomIdOrAlias}
|
|
||||||
groupCall={groupCall}
|
groupCall={groupCall}
|
||||||
isPasswordlessUser={passwordlessUser}
|
isPasswordlessUser={passwordlessUser}
|
||||||
isEmbedded={isEmbedded}
|
isEmbedded={isEmbedded}
|
||||||
@@ -85,7 +84,7 @@ export const RoomPage: FC = () => {
|
|||||||
hideHeader={hideHeader}
|
hideHeader={hideHeader}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
[client, roomIdOrAlias, passwordlessUser, isEmbedded, preload, hideHeader]
|
[client, passwordlessUser, isEmbedded, preload, hideHeader]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (loading || isRegistering) {
|
if (loading || isRegistering) {
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ import { useDefaultDevices } from "../settings/useSetting";
|
|||||||
export type MatrixInfo = {
|
export type MatrixInfo = {
|
||||||
displayName: string;
|
displayName: string;
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
|
roomId: string;
|
||||||
roomName: string;
|
roomName: string;
|
||||||
roomIdOrAlias: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
Reference in New Issue
Block a user