Skip to content

Commit 1c5694e

Browse files
authored
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>
1 parent 7a0ed54 commit 1c5694e

File tree

8 files changed

+21
-80
lines changed

8 files changed

+21
-80
lines changed

src/components/structures/SpaceRoomView.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ import AccessibleButton, { type ButtonEvent } from "../views/elements/Accessible
6464
import ErrorBoundary from "../views/elements/ErrorBoundary";
6565
import Field from "../views/elements/Field";
6666
import RoomFacePile from "../views/elements/RoomFacePile";
67-
import RoomName from "../views/elements/RoomName";
6867
import RoomTopic from "../views/elements/RoomTopic";
6968
import withValidation from "../views/elements/Validation";
7069
import RoomInfoLine from "../views/rooms/RoomInfoLine";
@@ -76,6 +75,7 @@ import RightPanel from "./RightPanel";
7675
import SpaceHierarchy, { showRoom } from "./SpaceHierarchy";
7776
import { type RoomPermalinkCreator } from "../../utils/permalinks/Permalinks";
7877
import SpacePillButton from "./SpacePillButton.tsx";
78+
import { useRoomName } from "../../hooks/useRoomName.ts";
7979

8080
interface IProps {
8181
space: Room;
@@ -214,6 +214,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => {
214214
const cli = useContext(MatrixClientContext);
215215
const myMembership = useMyRoomMembership(space);
216216
const userId = cli.getSafeUserId();
217+
const name = useRoomName(space);
217218

218219
const storeIsShowingSpaceMembers = useCallback(
219220
() =>
@@ -273,12 +274,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => {
273274
<RoomAvatar room={space} size="80px" viewAvatarOnClick={true} type="square" />
274275
</div>
275276
<div className="mx_SpaceRoomView_landing_name">
276-
<RoomName room={space}>
277-
{(name) => {
278-
const tags = { name: () => <h1>{name}</h1> };
279-
return _t("space|landing_welcome", {}, tags) as JSX.Element;
280-
}}
281-
</RoomName>
277+
{_t("space|landing_welcome", {}, { name: () => <h1>{name}</h1> })}
282278
</div>
283279
<div className="mx_SpaceRoomView_landing_infoBar">
284280
<RoomInfoLine room={space} />

src/components/views/dialogs/SpacePreferencesDialog.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import StyledCheckbox from "../elements/StyledCheckbox";
1717
import { useSettingValue } from "../../../hooks/useSettings";
1818
import SettingsStore from "../../../settings/SettingsStore";
1919
import { SettingLevel } from "../../../settings/SettingLevel";
20-
import RoomName from "../elements/RoomName";
2120
import { SpacePreferenceTab } from "../../../dispatcher/payloads/OpenSpacePreferencesPayload";
2221
import { type NonEmptyArray } from "../../../@types/common";
2322
import SettingsTab from "../settings/tabs/SettingsTab";
2423
import { SettingsSection } from "../settings/shared/SettingsSection";
2524
import { SettingsSubsection, SettingsSubsectionText } from "../settings/shared/SettingsSubsection";
25+
import { useRoomName } from "../../../hooks/useRoomName.ts";
2626

2727
interface IProps {
2828
space: Room;
@@ -60,6 +60,7 @@ const SpacePreferencesAppearanceTab: React.FC<Pick<IProps, "space">> = ({ space
6060
};
6161

6262
const SpacePreferencesDialog: React.FC<IProps> = ({ space, onFinished }) => {
63+
const name = useRoomName(space);
6364
const tabs: NonEmptyArray<Tab<SpacePreferenceTab>> = [
6465
new Tab(
6566
SpacePreferenceTab.Appearance,
@@ -77,9 +78,7 @@ const SpacePreferencesDialog: React.FC<IProps> = ({ space, onFinished }) => {
7778
title={_t("common|preferences")}
7879
fixedWidth={false}
7980
>
80-
<h4>
81-
<RoomName room={space} />
82-
</h4>
81+
<h4>{name}</h4>
8382
<div className="mx_SettingsDialog_content">
8483
<TabbedView tabs={tabs} activeTabId={SpacePreferenceTab.Appearance} onChange={() => {}} />
8584
</div>

src/components/views/elements/RoomName.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/components/views/right_panel/RoomSummaryCardView.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ import { _t } from "../../../languageHandler.tsx";
4646
import RoomAvatar from "../avatars/RoomAvatar.tsx";
4747
import { E2EStatus } from "../../../utils/ShieldUtils.ts";
4848
import { type RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks.ts";
49-
import RoomName from "../elements/RoomName.tsx";
5049
import { Linkify, topicToHtml } from "../../../HtmlUtils.tsx";
5150
import { useRoomSummaryCardViewModel } from "../../viewmodels/right_panel/RoomSummaryCardViewModel.tsx";
5251
import { useRoomTopicViewModel } from "../../viewmodels/right_panel/RoomSummaryCardTopicViewModel.tsx";
52+
import { useRoomName } from "../../../hooks/useRoomName.ts";
5353

5454
interface IProps {
5555
room: Room;
@@ -131,6 +131,8 @@ const RoomSummaryCardView: React.FC<IProps> = ({
131131
searchTerm = "",
132132
}) => {
133133
const vm = useRoomSummaryCardViewModel(room, permalinkCreator, onSearchCancel);
134+
// XXX: this name should be part of the view model
135+
const name = useRoomName(room);
134136

135137
// The search field is controlled and onSearchChange is debounced in RoomView,
136138
// so we need to set the value of the input right away
@@ -142,19 +144,15 @@ const RoomSummaryCardView: React.FC<IProps> = ({
142144
const roomInfo = (
143145
<header className="mx_RoomSummaryCard_container">
144146
<RoomAvatar room={room} size="80px" viewAvatarOnClick />
145-
<RoomName room={room}>
146-
{(name) => (
147-
<Heading
148-
as="h1"
149-
size="md"
150-
weight="semibold"
151-
className="mx_RoomSummaryCard_roomName text-primary"
152-
title={name}
153-
>
154-
{name}
155-
</Heading>
156-
)}
157-
</RoomName>
147+
<Heading
148+
as="h1"
149+
size="md"
150+
weight="semibold"
151+
className="mx_RoomSummaryCard_roomName text-primary"
152+
title={name}
153+
>
154+
{name}
155+
</Heading>
158156
<Text
159157
as="div"
160158
size="sm"

src/components/views/rooms/RoomPreviewCard.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ import { useRoomState } from "../../../hooks/useRoomState";
2222
import { useMyRoomMembership } from "../../../hooks/useRoomMembers";
2323
import AccessibleButton from "../elements/AccessibleButton";
2424
import InlineSpinner from "../elements/InlineSpinner";
25-
import RoomName from "../elements/RoomName";
2625
import RoomTopic from "../elements/RoomTopic";
2726
import RoomFacePile from "../elements/RoomFacePile";
2827
import RoomAvatar from "../avatars/RoomAvatar";
2928
import MemberAvatar from "../avatars/MemberAvatar";
3029
import { BetaPill } from "../beta/BetaCard";
3130
import RoomInfoLine from "./RoomInfoLine";
3231
import { isVideoRoom as calcIsVideoRoom } from "../../../utils/video-rooms";
32+
import { useRoomName } from "../../../hooks/useRoomName.ts";
3333

3434
interface IProps {
3535
room: Room;
@@ -56,6 +56,7 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
5656
const joinRule = useRoomState(room, (state) => state.getJoinRule());
5757
const cannotJoin =
5858
getEffectiveMembership(myMembership) === EffectiveMembership.Leave && joinRule !== JoinRule.Public;
59+
const name = useRoomName(room);
5960

6061
const viewLabs = (): void =>
6162
defaultDispatcher.dispatch({
@@ -169,9 +170,7 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
169170
<div className="mx_RoomPreviewCard">
170171
{inviterSection}
171172
<div className="mx_RoomPreviewCard_avatar">{avatarRow}</div>
172-
<h1 className="mx_RoomPreviewCard_name">
173-
<RoomName room={room} />
174-
</h1>
173+
<h1 className="mx_RoomPreviewCard_name">{name}</h1>
175174
<RoomInfoLine room={room} />
176175
<RoomTopic room={room} className="mx_RoomPreviewCard_topic" />
177176
{room.getJoinRule() === "public" && <RoomFacePile room={room} />}

src/models/Call.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,6 @@ export class ElementCall extends Call {
721721
// 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)
722722
const analyticsID: string = accountAnalyticsData?.pseudonymousAnalyticsOptIn ? accountAnalyticsData?.id : "";
723723

724-
params.append("analyticsID", analyticsID); // Legacy, deprecated in favour of posthogUserId
725724
params.append("posthogUserId", analyticsID);
726725
params.append("posthogApiHost", posthogConfig.api_host);
727726
params.append("posthogApiKey", posthogConfig.project_api_key);

src/utils/pages.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9-
import { logger } from "matrix-js-sdk/src/logger";
109
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
1110

1211
import { type IConfigOptions } from "../IConfigOptions";
@@ -19,19 +18,6 @@ export function getHomePageUrl(appConfig: IConfigOptions, matrixClient: MatrixCl
1918
const pagesConfig = config.get("embedded_pages");
2019
let pageUrl = pagesConfig ? new SnakedObject(pagesConfig).get("home_url") : null;
2120

22-
if (!pageUrl) {
23-
// This is a deprecated config option for the home page
24-
// (despite the name, given we also now have a welcome
25-
// page, which is not the same).
26-
pageUrl = (<any>appConfig).welcomePageUrl;
27-
if (pageUrl) {
28-
logger.warn(
29-
"You are using a deprecated config option: `welcomePageUrl`. Please use " +
30-
"`embedded_pages.home_url` instead, per https://github.com/vector-im/element-web/issues/21428",
31-
);
32-
}
33-
}
34-
3521
if (!pageUrl) {
3622
pageUrl = getEmbeddedPagesWellKnown(matrixClient)?.home_url;
3723
}

test/unit-tests/models/Call-test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,6 @@ describe("ElementCall", () => {
737737
if (!(call instanceof ElementCall)) throw new Error("Failed to create call");
738738

739739
const urlParams = new URLSearchParams(new URL(call.widget.url).hash.slice(1));
740-
expect(urlParams.get("analyticsID")).toBe("123456789987654321");
741740
expect(urlParams.get("posthogUserId")).toBe("123456789987654321");
742741
expect(urlParams.get("posthogApiHost")).toBe("https://posthog");
743742
expect(urlParams.get("posthogApiKey")).toBe("DEADBEEF");

0 commit comments

Comments
 (0)