Remove deprecated config, param & component (#32607)

* Remove long-deprecated `welcomePageUrl` config

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Remove deprecated EC `analyticsID` param in favour of `posthogUserId`

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Remove use of deprecated RoomName component in favour of useRoomName hook

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2026-02-24 11:04:05 +00:00
committed by GitHub
parent 7a0ed5443f
commit 1c5694e625
8 changed files with 21 additions and 80 deletions
+3 -7
View File
@@ -64,7 +64,6 @@ import AccessibleButton, { type ButtonEvent } from "../views/elements/Accessible
import ErrorBoundary from "../views/elements/ErrorBoundary"; import ErrorBoundary from "../views/elements/ErrorBoundary";
import Field from "../views/elements/Field"; import Field from "../views/elements/Field";
import RoomFacePile from "../views/elements/RoomFacePile"; import RoomFacePile from "../views/elements/RoomFacePile";
import RoomName from "../views/elements/RoomName";
import RoomTopic from "../views/elements/RoomTopic"; import RoomTopic from "../views/elements/RoomTopic";
import withValidation from "../views/elements/Validation"; import withValidation from "../views/elements/Validation";
import RoomInfoLine from "../views/rooms/RoomInfoLine"; import RoomInfoLine from "../views/rooms/RoomInfoLine";
@@ -76,6 +75,7 @@ import RightPanel from "./RightPanel";
import SpaceHierarchy, { showRoom } from "./SpaceHierarchy"; import SpaceHierarchy, { showRoom } from "./SpaceHierarchy";
import { type RoomPermalinkCreator } from "../../utils/permalinks/Permalinks"; import { type RoomPermalinkCreator } from "../../utils/permalinks/Permalinks";
import SpacePillButton from "./SpacePillButton.tsx"; import SpacePillButton from "./SpacePillButton.tsx";
import { useRoomName } from "../../hooks/useRoomName.ts";
interface IProps { interface IProps {
space: Room; space: Room;
@@ -214,6 +214,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => {
const cli = useContext(MatrixClientContext); const cli = useContext(MatrixClientContext);
const myMembership = useMyRoomMembership(space); const myMembership = useMyRoomMembership(space);
const userId = cli.getSafeUserId(); const userId = cli.getSafeUserId();
const name = useRoomName(space);
const storeIsShowingSpaceMembers = useCallback( const storeIsShowingSpaceMembers = useCallback(
() => () =>
@@ -273,12 +274,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => {
<RoomAvatar room={space} size="80px" viewAvatarOnClick={true} type="square" /> <RoomAvatar room={space} size="80px" viewAvatarOnClick={true} type="square" />
</div> </div>
<div className="mx_SpaceRoomView_landing_name"> <div className="mx_SpaceRoomView_landing_name">
<RoomName room={space}> {_t("space|landing_welcome", {}, { name: () => <h1>{name}</h1> })}
{(name) => {
const tags = { name: () => <h1>{name}</h1> };
return _t("space|landing_welcome", {}, tags) as JSX.Element;
}}
</RoomName>
</div> </div>
<div className="mx_SpaceRoomView_landing_infoBar"> <div className="mx_SpaceRoomView_landing_infoBar">
<RoomInfoLine room={space} /> <RoomInfoLine room={space} />
@@ -17,12 +17,12 @@ import StyledCheckbox from "../elements/StyledCheckbox";
import { useSettingValue } from "../../../hooks/useSettings"; import { useSettingValue } from "../../../hooks/useSettings";
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import { SettingLevel } from "../../../settings/SettingLevel"; import { SettingLevel } from "../../../settings/SettingLevel";
import RoomName from "../elements/RoomName";
import { SpacePreferenceTab } from "../../../dispatcher/payloads/OpenSpacePreferencesPayload"; import { SpacePreferenceTab } from "../../../dispatcher/payloads/OpenSpacePreferencesPayload";
import { type NonEmptyArray } from "../../../@types/common"; import { type NonEmptyArray } from "../../../@types/common";
import SettingsTab from "../settings/tabs/SettingsTab"; import SettingsTab from "../settings/tabs/SettingsTab";
import { SettingsSection } from "../settings/shared/SettingsSection"; import { SettingsSection } from "../settings/shared/SettingsSection";
import { SettingsSubsection, SettingsSubsectionText } from "../settings/shared/SettingsSubsection"; import { SettingsSubsection, SettingsSubsectionText } from "../settings/shared/SettingsSubsection";
import { useRoomName } from "../../../hooks/useRoomName.ts";
interface IProps { interface IProps {
space: Room; space: Room;
@@ -60,6 +60,7 @@ const SpacePreferencesAppearanceTab: React.FC<Pick<IProps, "space">> = ({ space
}; };
const SpacePreferencesDialog: React.FC<IProps> = ({ space, onFinished }) => { const SpacePreferencesDialog: React.FC<IProps> = ({ space, onFinished }) => {
const name = useRoomName(space);
const tabs: NonEmptyArray<Tab<SpacePreferenceTab>> = [ const tabs: NonEmptyArray<Tab<SpacePreferenceTab>> = [
new Tab( new Tab(
SpacePreferenceTab.Appearance, SpacePreferenceTab.Appearance,
@@ -77,9 +78,7 @@ const SpacePreferencesDialog: React.FC<IProps> = ({ space, onFinished }) => {
title={_t("common|preferences")} title={_t("common|preferences")}
fixedWidth={false} fixedWidth={false}
> >
<h4> <h4>{name}</h4>
<RoomName room={space} />
</h4>
<div className="mx_SettingsDialog_content"> <div className="mx_SettingsDialog_content">
<TabbedView tabs={tabs} activeTabId={SpacePreferenceTab.Appearance} onChange={() => {}} /> <TabbedView tabs={tabs} activeTabId={SpacePreferenceTab.Appearance} onChange={() => {}} />
</div> </div>
@@ -1,35 +0,0 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2021 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import React, { type JSX, useEffect, useState } from "react";
import { type Room, RoomEvent } from "matrix-js-sdk/src/matrix";
import { useTypedEventEmitter } from "../../../hooks/useEventEmitter";
interface IProps {
room?: Room;
children?(this: void, name: string): JSX.Element;
}
/**
* @deprecated use `useRoomName.ts` instead
*/
const RoomName = ({ room, children }: IProps): JSX.Element => {
const [name, setName] = useState(room?.name);
useTypedEventEmitter(room, RoomEvent.Name, () => {
setName(room?.name);
});
useEffect(() => {
setName(room?.name);
}, [room]);
if (children) return children(name ?? "");
return <>{name || ""}</>;
};
export default RoomName;
@@ -46,10 +46,10 @@ import { _t } from "../../../languageHandler.tsx";
import RoomAvatar from "../avatars/RoomAvatar.tsx"; import RoomAvatar from "../avatars/RoomAvatar.tsx";
import { E2EStatus } from "../../../utils/ShieldUtils.ts"; import { E2EStatus } from "../../../utils/ShieldUtils.ts";
import { type RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks.ts"; import { type RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks.ts";
import RoomName from "../elements/RoomName.tsx";
import { Linkify, topicToHtml } from "../../../HtmlUtils.tsx"; import { Linkify, topicToHtml } from "../../../HtmlUtils.tsx";
import { useRoomSummaryCardViewModel } from "../../viewmodels/right_panel/RoomSummaryCardViewModel.tsx"; import { useRoomSummaryCardViewModel } from "../../viewmodels/right_panel/RoomSummaryCardViewModel.tsx";
import { useRoomTopicViewModel } from "../../viewmodels/right_panel/RoomSummaryCardTopicViewModel.tsx"; import { useRoomTopicViewModel } from "../../viewmodels/right_panel/RoomSummaryCardTopicViewModel.tsx";
import { useRoomName } from "../../../hooks/useRoomName.ts";
interface IProps { interface IProps {
room: Room; room: Room;
@@ -131,6 +131,8 @@ const RoomSummaryCardView: React.FC<IProps> = ({
searchTerm = "", searchTerm = "",
}) => { }) => {
const vm = useRoomSummaryCardViewModel(room, permalinkCreator, onSearchCancel); const vm = useRoomSummaryCardViewModel(room, permalinkCreator, onSearchCancel);
// XXX: this name should be part of the view model
const name = useRoomName(room);
// The search field is controlled and onSearchChange is debounced in RoomView, // The search field is controlled and onSearchChange is debounced in RoomView,
// so we need to set the value of the input right away // so we need to set the value of the input right away
@@ -142,19 +144,15 @@ const RoomSummaryCardView: React.FC<IProps> = ({
const roomInfo = ( const roomInfo = (
<header className="mx_RoomSummaryCard_container"> <header className="mx_RoomSummaryCard_container">
<RoomAvatar room={room} size="80px" viewAvatarOnClick /> <RoomAvatar room={room} size="80px" viewAvatarOnClick />
<RoomName room={room}> <Heading
{(name) => ( as="h1"
<Heading size="md"
as="h1" weight="semibold"
size="md" className="mx_RoomSummaryCard_roomName text-primary"
weight="semibold" title={name}
className="mx_RoomSummaryCard_roomName text-primary" >
title={name} {name}
> </Heading>
{name}
</Heading>
)}
</RoomName>
<Text <Text
as="div" as="div"
size="sm" size="sm"
@@ -22,7 +22,6 @@ import { useRoomState } from "../../../hooks/useRoomState";
import { useMyRoomMembership } from "../../../hooks/useRoomMembers"; import { useMyRoomMembership } from "../../../hooks/useRoomMembers";
import AccessibleButton from "../elements/AccessibleButton"; import AccessibleButton from "../elements/AccessibleButton";
import InlineSpinner from "../elements/InlineSpinner"; import InlineSpinner from "../elements/InlineSpinner";
import RoomName from "../elements/RoomName";
import RoomTopic from "../elements/RoomTopic"; import RoomTopic from "../elements/RoomTopic";
import RoomFacePile from "../elements/RoomFacePile"; import RoomFacePile from "../elements/RoomFacePile";
import RoomAvatar from "../avatars/RoomAvatar"; import RoomAvatar from "../avatars/RoomAvatar";
@@ -30,6 +29,7 @@ import MemberAvatar from "../avatars/MemberAvatar";
import { BetaPill } from "../beta/BetaCard"; import { BetaPill } from "../beta/BetaCard";
import RoomInfoLine from "./RoomInfoLine"; import RoomInfoLine from "./RoomInfoLine";
import { isVideoRoom as calcIsVideoRoom } from "../../../utils/video-rooms"; import { isVideoRoom as calcIsVideoRoom } from "../../../utils/video-rooms";
import { useRoomName } from "../../../hooks/useRoomName.ts";
interface IProps { interface IProps {
room: Room; room: Room;
@@ -56,6 +56,7 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
const joinRule = useRoomState(room, (state) => state.getJoinRule()); const joinRule = useRoomState(room, (state) => state.getJoinRule());
const cannotJoin = const cannotJoin =
getEffectiveMembership(myMembership) === EffectiveMembership.Leave && joinRule !== JoinRule.Public; getEffectiveMembership(myMembership) === EffectiveMembership.Leave && joinRule !== JoinRule.Public;
const name = useRoomName(room);
const viewLabs = (): void => const viewLabs = (): void =>
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
@@ -169,9 +170,7 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
<div className="mx_RoomPreviewCard"> <div className="mx_RoomPreviewCard">
{inviterSection} {inviterSection}
<div className="mx_RoomPreviewCard_avatar">{avatarRow}</div> <div className="mx_RoomPreviewCard_avatar">{avatarRow}</div>
<h1 className="mx_RoomPreviewCard_name"> <h1 className="mx_RoomPreviewCard_name">{name}</h1>
<RoomName room={room} />
</h1>
<RoomInfoLine room={room} /> <RoomInfoLine room={room} />
<RoomTopic room={room} className="mx_RoomPreviewCard_topic" /> <RoomTopic room={room} className="mx_RoomPreviewCard_topic" />
{room.getJoinRule() === "public" && <RoomFacePile room={room} />} {room.getJoinRule() === "public" && <RoomFacePile room={room} />}
-1
View File
@@ -721,7 +721,6 @@ export class ElementCall extends Call {
// We can pass the raw EW analyticsID here since we need to trust EC with not sending sensitive data to posthog (EC has access to more sensible data than the analyticsID e.g. the username) // We can pass the raw EW analyticsID here since we need to trust EC with not sending sensitive data to posthog (EC has access to more sensible data than the analyticsID e.g. the username)
const analyticsID: string = accountAnalyticsData?.pseudonymousAnalyticsOptIn ? accountAnalyticsData?.id : ""; const analyticsID: string = accountAnalyticsData?.pseudonymousAnalyticsOptIn ? accountAnalyticsData?.id : "";
params.append("analyticsID", analyticsID); // Legacy, deprecated in favour of posthogUserId
params.append("posthogUserId", analyticsID); params.append("posthogUserId", analyticsID);
params.append("posthogApiHost", posthogConfig.api_host); params.append("posthogApiHost", posthogConfig.api_host);
params.append("posthogApiKey", posthogConfig.project_api_key); params.append("posthogApiKey", posthogConfig.project_api_key);
-14
View File
@@ -6,7 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details. Please see LICENSE files in the repository root for full details.
*/ */
import { logger } from "matrix-js-sdk/src/logger";
import { type MatrixClient } from "matrix-js-sdk/src/matrix"; import { type MatrixClient } from "matrix-js-sdk/src/matrix";
import { type IConfigOptions } from "../IConfigOptions"; import { type IConfigOptions } from "../IConfigOptions";
@@ -19,19 +18,6 @@ export function getHomePageUrl(appConfig: IConfigOptions, matrixClient: MatrixCl
const pagesConfig = config.get("embedded_pages"); const pagesConfig = config.get("embedded_pages");
let pageUrl = pagesConfig ? new SnakedObject(pagesConfig).get("home_url") : null; let pageUrl = pagesConfig ? new SnakedObject(pagesConfig).get("home_url") : null;
if (!pageUrl) {
// This is a deprecated config option for the home page
// (despite the name, given we also now have a welcome
// page, which is not the same).
pageUrl = (<any>appConfig).welcomePageUrl;
if (pageUrl) {
logger.warn(
"You are using a deprecated config option: `welcomePageUrl`. Please use " +
"`embedded_pages.home_url` instead, per https://github.com/vector-im/element-web/issues/21428",
);
}
}
if (!pageUrl) { if (!pageUrl) {
pageUrl = getEmbeddedPagesWellKnown(matrixClient)?.home_url; pageUrl = getEmbeddedPagesWellKnown(matrixClient)?.home_url;
} }
-1
View File
@@ -737,7 +737,6 @@ describe("ElementCall", () => {
if (!(call instanceof ElementCall)) throw new Error("Failed to create call"); if (!(call instanceof ElementCall)) throw new Error("Failed to create call");
const urlParams = new URLSearchParams(new URL(call.widget.url).hash.slice(1)); const urlParams = new URLSearchParams(new URL(call.widget.url).hash.slice(1));
expect(urlParams.get("analyticsID")).toBe("123456789987654321");
expect(urlParams.get("posthogUserId")).toBe("123456789987654321"); expect(urlParams.get("posthogUserId")).toBe("123456789987654321");
expect(urlParams.get("posthogApiHost")).toBe("https://posthog"); expect(urlParams.get("posthogApiHost")).toBe("https://posthog");
expect(urlParams.get("posthogApiKey")).toBe("DEADBEEF"); expect(urlParams.get("posthogApiKey")).toBe("DEADBEEF");