From 7e320e5c7a4287f719691d2b559bcb9f81e943f7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 18 Apr 2024 16:38:15 +0100 Subject: [PATCH] Take the TAC out of labs! Requires https://github.com/matrix-org/matrix-react-sdk/pull/12438 and ideally https://github.com/matrix-org/matrix-react-sdk/pull/12418 --- .../views/dialogs/devtools/RoomNotifications.tsx | 7 ++----- src/components/views/spaces/SpacePanel.tsx | 7 ++----- src/hooks/useUnreadNotifications.ts | 9 +++------ src/settings/Settings.tsx | 9 --------- src/stores/notifications/RoomNotificationStateStore.ts | 4 +--- 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/components/views/dialogs/devtools/RoomNotifications.tsx b/src/components/views/dialogs/devtools/RoomNotifications.tsx index 5d03ee7c3a5..397db1fa4bc 100644 --- a/src/components/views/dialogs/devtools/RoomNotifications.tsx +++ b/src/components/views/dialogs/devtools/RoomNotifications.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import { NotificationCountType, Room, Thread, ReceiptType } from "matrix-js-sdk/src/matrix"; -import React, { useContext, useMemo } from "react"; +import React, { useContext } from "react"; import { ReadReceipt } from "matrix-js-sdk/src/models/read-receipt"; import MatrixClientContext from "../../../../contexts/MatrixClientContext"; @@ -25,7 +25,6 @@ import { determineUnreadState } from "../../../../RoomNotifs"; import { humanReadableNotificationLevel } from "../../../../stores/notifications/NotificationLevel"; import { doesRoomOrThreadHaveUnreadMessages } from "../../../../Unread"; import BaseTool, { DevtoolsContext, IDevtoolsProps } from "./BaseTool"; -import SettingsStore from "../../../../settings/SettingsStore"; function UserReadUpTo({ target }: { target: ReadReceipt }): JSX.Element { const cli = useContext(MatrixClientContext); @@ -66,12 +65,10 @@ function UserReadUpTo({ target }: { target: ReadReceipt }): JSX.Elemen } export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Element { - const tacEnabled = useMemo(() => SettingsStore.getValue("threadsActivityCentre"), []); - const { room } = useContext(DevtoolsContext); const cli = useContext(MatrixClientContext); - const { level, count } = determineUnreadState(room, undefined, !tacEnabled); + const { level, count } = determineUnreadState(room, undefined, false); const [notificationState] = useNotificationState(room); return ( diff --git a/src/components/views/spaces/SpacePanel.tsx b/src/components/views/spaces/SpacePanel.tsx index 429a18e1344..8d3041ff1ed 100644 --- a/src/components/views/spaces/SpacePanel.tsx +++ b/src/components/views/spaces/SpacePanel.tsx @@ -368,8 +368,6 @@ const SpacePanel: React.FC = () => { } }); - const isThreadsActivityCentreEnabled = useSettingValue("threadsActivityCentre"); - return ( {({ onKeyDownHandler, onDragEndHandler }) => ( @@ -426,9 +424,8 @@ const SpacePanel: React.FC = () => { )} - {isThreadsActivityCentreEnabled && ( - - )} + + diff --git a/src/hooks/useUnreadNotifications.ts b/src/hooks/useUnreadNotifications.ts index e0a2f1eeff2..f687ee7f1dd 100644 --- a/src/hooks/useUnreadNotifications.ts +++ b/src/hooks/useUnreadNotifications.ts @@ -15,13 +15,12 @@ limitations under the License. */ import { RoomEvent } from "matrix-js-sdk/src/matrix"; -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import type { NotificationCount, Room } from "matrix-js-sdk/src/matrix"; import { determineUnreadState } from "../RoomNotifs"; import { NotificationLevel } from "../stores/notifications/NotificationLevel"; import { useEventEmitter } from "./useEventEmitter"; -import SettingsStore from "../settings/SettingsStore"; export const useUnreadNotifications = ( room?: Room, @@ -31,8 +30,6 @@ export const useUnreadNotifications = ( count: number; level: NotificationLevel; } => { - const tacEnabled = useMemo(() => SettingsStore.getValue("threadsActivityCentre"), []); - const [symbol, setSymbol] = useState(null); const [count, setCount] = useState(0); const [level, setLevel] = useState(NotificationLevel.None); @@ -53,11 +50,11 @@ export const useUnreadNotifications = ( useEventEmitter(room, RoomEvent.MyMembership, () => updateNotificationState()); const updateNotificationState = useCallback(() => { - const { symbol, count, level } = determineUnreadState(room, threadId, !tacEnabled); + const { symbol, count, level } = determineUnreadState(room, threadId, false); setSymbol(symbol); setCount(count); setLevel(level); - }, [room, threadId, tacEnabled]); + }, [room, threadId]); useEffect(() => { updateNotificationState(); diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 6be0a6b46fb..2702ab93cc8 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -1148,15 +1148,6 @@ export const SETTINGS: { [setting: string]: ISetting } = { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, default: [], }, - "threadsActivityCentre": { - supportedLevels: LEVELS_ACCOUNT_SETTINGS, - labsGroup: LabGroup.Threads, - controller: new ReloadOnChangeController(), - displayName: _td("labs|threads_activity_centre"), - description: () => _t("labs|threads_activity_centre_description", { brand: SdkConfig.get().brand }), - default: false, - isFeature: true, - }, /** * Enable or disable the release announcement feature */ diff --git a/src/stores/notifications/RoomNotificationStateStore.ts b/src/stores/notifications/RoomNotificationStateStore.ts index f2d10ac4fb1..502d2dcce76 100644 --- a/src/stores/notifications/RoomNotificationStateStore.ts +++ b/src/stores/notifications/RoomNotificationStateStore.ts @@ -42,8 +42,6 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { private listMap = new Map(); private _globalState = new SummarizedNotificationState(); - private tacEnabled = SettingsStore.getValue("threadsActivityCentre"); - private constructor(dispatcher = defaultDispatcher) { super(dispatcher, {}); SettingsStore.watchSetting("feature_dynamic_room_predecessors", null, () => { @@ -99,7 +97,7 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { */ public getRoomState(room: Room): RoomNotificationState { if (!this.roomMap.has(room)) { - this.roomMap.set(room, new RoomNotificationState(room, !this.tacEnabled)); + this.roomMap.set(room, new RoomNotificationState(room, false)); } return this.roomMap.get(room)!; }