mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-04 19:56:45 +02:00
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:
parent
7a0ed5443f
commit
1c5694e625
@ -64,7 +64,6 @@ import AccessibleButton, { type ButtonEvent } from "../views/elements/Accessible
|
||||
import ErrorBoundary from "../views/elements/ErrorBoundary";
|
||||
import Field from "../views/elements/Field";
|
||||
import RoomFacePile from "../views/elements/RoomFacePile";
|
||||
import RoomName from "../views/elements/RoomName";
|
||||
import RoomTopic from "../views/elements/RoomTopic";
|
||||
import withValidation from "../views/elements/Validation";
|
||||
import RoomInfoLine from "../views/rooms/RoomInfoLine";
|
||||
@ -76,6 +75,7 @@ import RightPanel from "./RightPanel";
|
||||
import SpaceHierarchy, { showRoom } from "./SpaceHierarchy";
|
||||
import { type RoomPermalinkCreator } from "../../utils/permalinks/Permalinks";
|
||||
import SpacePillButton from "./SpacePillButton.tsx";
|
||||
import { useRoomName } from "../../hooks/useRoomName.ts";
|
||||
|
||||
interface IProps {
|
||||
space: Room;
|
||||
@ -214,6 +214,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
const myMembership = useMyRoomMembership(space);
|
||||
const userId = cli.getSafeUserId();
|
||||
const name = useRoomName(space);
|
||||
|
||||
const storeIsShowingSpaceMembers = useCallback(
|
||||
() =>
|
||||
@ -273,12 +274,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => {
|
||||
<RoomAvatar room={space} size="80px" viewAvatarOnClick={true} type="square" />
|
||||
</div>
|
||||
<div className="mx_SpaceRoomView_landing_name">
|
||||
<RoomName room={space}>
|
||||
{(name) => {
|
||||
const tags = { name: () => <h1>{name}</h1> };
|
||||
return _t("space|landing_welcome", {}, tags) as JSX.Element;
|
||||
}}
|
||||
</RoomName>
|
||||
{_t("space|landing_welcome", {}, { name: () => <h1>{name}</h1> })}
|
||||
</div>
|
||||
<div className="mx_SpaceRoomView_landing_infoBar">
|
||||
<RoomInfoLine room={space} />
|
||||
|
||||
@ -17,12 +17,12 @@ import StyledCheckbox from "../elements/StyledCheckbox";
|
||||
import { useSettingValue } from "../../../hooks/useSettings";
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
import { SettingLevel } from "../../../settings/SettingLevel";
|
||||
import RoomName from "../elements/RoomName";
|
||||
import { SpacePreferenceTab } from "../../../dispatcher/payloads/OpenSpacePreferencesPayload";
|
||||
import { type NonEmptyArray } from "../../../@types/common";
|
||||
import SettingsTab from "../settings/tabs/SettingsTab";
|
||||
import { SettingsSection } from "../settings/shared/SettingsSection";
|
||||
import { SettingsSubsection, SettingsSubsectionText } from "../settings/shared/SettingsSubsection";
|
||||
import { useRoomName } from "../../../hooks/useRoomName.ts";
|
||||
|
||||
interface IProps {
|
||||
space: Room;
|
||||
@ -60,6 +60,7 @@ const SpacePreferencesAppearanceTab: React.FC<Pick<IProps, "space">> = ({ space
|
||||
};
|
||||
|
||||
const SpacePreferencesDialog: React.FC<IProps> = ({ space, onFinished }) => {
|
||||
const name = useRoomName(space);
|
||||
const tabs: NonEmptyArray<Tab<SpacePreferenceTab>> = [
|
||||
new Tab(
|
||||
SpacePreferenceTab.Appearance,
|
||||
@ -77,9 +78,7 @@ const SpacePreferencesDialog: React.FC<IProps> = ({ space, onFinished }) => {
|
||||
title={_t("common|preferences")}
|
||||
fixedWidth={false}
|
||||
>
|
||||
<h4>
|
||||
<RoomName room={space} />
|
||||
</h4>
|
||||
<h4>{name}</h4>
|
||||
<div className="mx_SettingsDialog_content">
|
||||
<TabbedView tabs={tabs} activeTabId={SpacePreferenceTab.Appearance} onChange={() => {}} />
|
||||
</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 { E2EStatus } from "../../../utils/ShieldUtils.ts";
|
||||
import { type RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks.ts";
|
||||
import RoomName from "../elements/RoomName.tsx";
|
||||
import { Linkify, topicToHtml } from "../../../HtmlUtils.tsx";
|
||||
import { useRoomSummaryCardViewModel } from "../../viewmodels/right_panel/RoomSummaryCardViewModel.tsx";
|
||||
import { useRoomTopicViewModel } from "../../viewmodels/right_panel/RoomSummaryCardTopicViewModel.tsx";
|
||||
import { useRoomName } from "../../../hooks/useRoomName.ts";
|
||||
|
||||
interface IProps {
|
||||
room: Room;
|
||||
@ -131,6 +131,8 @@ const RoomSummaryCardView: React.FC<IProps> = ({
|
||||
searchTerm = "",
|
||||
}) => {
|
||||
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,
|
||||
// so we need to set the value of the input right away
|
||||
@ -142,19 +144,15 @@ const RoomSummaryCardView: React.FC<IProps> = ({
|
||||
const roomInfo = (
|
||||
<header className="mx_RoomSummaryCard_container">
|
||||
<RoomAvatar room={room} size="80px" viewAvatarOnClick />
|
||||
<RoomName room={room}>
|
||||
{(name) => (
|
||||
<Heading
|
||||
as="h1"
|
||||
size="md"
|
||||
weight="semibold"
|
||||
className="mx_RoomSummaryCard_roomName text-primary"
|
||||
title={name}
|
||||
>
|
||||
{name}
|
||||
</Heading>
|
||||
)}
|
||||
</RoomName>
|
||||
<Heading
|
||||
as="h1"
|
||||
size="md"
|
||||
weight="semibold"
|
||||
className="mx_RoomSummaryCard_roomName text-primary"
|
||||
title={name}
|
||||
>
|
||||
{name}
|
||||
</Heading>
|
||||
<Text
|
||||
as="div"
|
||||
size="sm"
|
||||
|
||||
@ -22,7 +22,6 @@ import { useRoomState } from "../../../hooks/useRoomState";
|
||||
import { useMyRoomMembership } from "../../../hooks/useRoomMembers";
|
||||
import AccessibleButton from "../elements/AccessibleButton";
|
||||
import InlineSpinner from "../elements/InlineSpinner";
|
||||
import RoomName from "../elements/RoomName";
|
||||
import RoomTopic from "../elements/RoomTopic";
|
||||
import RoomFacePile from "../elements/RoomFacePile";
|
||||
import RoomAvatar from "../avatars/RoomAvatar";
|
||||
@ -30,6 +29,7 @@ import MemberAvatar from "../avatars/MemberAvatar";
|
||||
import { BetaPill } from "../beta/BetaCard";
|
||||
import RoomInfoLine from "./RoomInfoLine";
|
||||
import { isVideoRoom as calcIsVideoRoom } from "../../../utils/video-rooms";
|
||||
import { useRoomName } from "../../../hooks/useRoomName.ts";
|
||||
|
||||
interface IProps {
|
||||
room: Room;
|
||||
@ -56,6 +56,7 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
|
||||
const joinRule = useRoomState(room, (state) => state.getJoinRule());
|
||||
const cannotJoin =
|
||||
getEffectiveMembership(myMembership) === EffectiveMembership.Leave && joinRule !== JoinRule.Public;
|
||||
const name = useRoomName(room);
|
||||
|
||||
const viewLabs = (): void =>
|
||||
defaultDispatcher.dispatch({
|
||||
@ -169,9 +170,7 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
|
||||
<div className="mx_RoomPreviewCard">
|
||||
{inviterSection}
|
||||
<div className="mx_RoomPreviewCard_avatar">{avatarRow}</div>
|
||||
<h1 className="mx_RoomPreviewCard_name">
|
||||
<RoomName room={room} />
|
||||
</h1>
|
||||
<h1 className="mx_RoomPreviewCard_name">{name}</h1>
|
||||
<RoomInfoLine room={room} />
|
||||
<RoomTopic room={room} className="mx_RoomPreviewCard_topic" />
|
||||
{room.getJoinRule() === "public" && <RoomFacePile room={room} />}
|
||||
|
||||
@ -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)
|
||||
const analyticsID: string = accountAnalyticsData?.pseudonymousAnalyticsOptIn ? accountAnalyticsData?.id : "";
|
||||
|
||||
params.append("analyticsID", analyticsID); // Legacy, deprecated in favour of posthogUserId
|
||||
params.append("posthogUserId", analyticsID);
|
||||
params.append("posthogApiHost", posthogConfig.api_host);
|
||||
params.append("posthogApiKey", posthogConfig.project_api_key);
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { type IConfigOptions } from "../IConfigOptions";
|
||||
@ -19,19 +18,6 @@ export function getHomePageUrl(appConfig: IConfigOptions, matrixClient: MatrixCl
|
||||
const pagesConfig = config.get("embedded_pages");
|
||||
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) {
|
||||
pageUrl = getEmbeddedPagesWellKnown(matrixClient)?.home_url;
|
||||
}
|
||||
|
||||
@ -737,7 +737,6 @@ describe("ElementCall", () => {
|
||||
if (!(call instanceof ElementCall)) throw new Error("Failed to create call");
|
||||
|
||||
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("posthogApiHost")).toBe("https://posthog");
|
||||
expect(urlParams.get("posthogApiKey")).toBe("DEADBEEF");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user