Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Take the TAC out of labs!
Browse files Browse the repository at this point in the history
Requires #12438
and ideally #12418
  • Loading branch information
dbkr committed Apr 18, 2024
1 parent 2c848d7 commit 7e320e5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
7 changes: 2 additions & 5 deletions src/components/views/dialogs/devtools/RoomNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<any, any> }): JSX.Element {
const cli = useContext(MatrixClientContext);
Expand Down Expand Up @@ -66,12 +65,10 @@ function UserReadUpTo({ target }: { target: ReadReceipt<any, any> }): 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 (
Expand Down
7 changes: 2 additions & 5 deletions src/components/views/spaces/SpacePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,6 @@ const SpacePanel: React.FC = () => {
}
});

const isThreadsActivityCentreEnabled = useSettingValue<boolean>("threadsActivityCentre");

return (
<RovingTabIndexProvider handleHomeEnd handleUpDown={!dragging}>
{({ onKeyDownHandler, onDragEndHandler }) => (
Expand Down Expand Up @@ -426,9 +424,8 @@ const SpacePanel: React.FC = () => {
)}
</Droppable>

{isThreadsActivityCentreEnabled && (
<ThreadsActivityCentre displayButtonLabel={!isPanelCollapsed} />
)}
<ThreadsActivityCentre displayButtonLabel={!isPanelCollapsed} />

<QuickSettingsButton isPanelCollapsed={isPanelCollapsed} />
</nav>
</DragDropContext>
Expand Down
9 changes: 3 additions & 6 deletions src/hooks/useUnreadNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -31,8 +30,6 @@ export const useUnreadNotifications = (
count: number;
level: NotificationLevel;
} => {
const tacEnabled = useMemo(() => SettingsStore.getValue("threadsActivityCentre"), []);

const [symbol, setSymbol] = useState<string | null>(null);
const [count, setCount] = useState<number>(0);
const [level, setLevel] = useState<NotificationLevel>(NotificationLevel.None);
Expand All @@ -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();
Expand Down
9 changes: 0 additions & 9 deletions src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
4 changes: 1 addition & 3 deletions src/stores/notifications/RoomNotificationStateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient<IState> {
private listMap = new Map<TagID, ListNotificationState>();
private _globalState = new SummarizedNotificationState();

private tacEnabled = SettingsStore.getValue("threadsActivityCentre");

private constructor(dispatcher = defaultDispatcher) {
super(dispatcher, {});
SettingsStore.watchSetting("feature_dynamic_room_predecessors", null, () => {
Expand Down Expand Up @@ -99,7 +97,7 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient<IState> {
*/
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)!;
}
Expand Down

0 comments on commit 7e320e5

Please sign in to comment.