Add labs flag for Threads Activity Centre (#12137)

* Add `Thread Activity centre` labs flag

* Rename translation string

* Update supportedLevels

* Fix labs subsection test

* Update Threads Activity Centre label

* Make threads activity centre labs flag split out unread counts

Just shows notif & unread counts for main thread if the TAC is enabled.

* Fix tests

* Simpler fix

* Pass in & cache the status of the TAC labs flag

* Pass includeThreads as setting to doesRoomHaveUnreadMessages too

* Fix tests

---------

Co-authored-by: David Baker <dbkr@users.noreply.github.com>
This commit is contained in:
Florian Duros 2024-01-29 18:52:48 +01:00 committed by GitHub
parent a370a5cfa4
commit 77e1649f0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 111 additions and 56 deletions

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import { NotificationCountType, Room, Thread, ReceiptType } from "matrix-js-sdk/src/matrix";
import React, { useContext } from "react";
import React, { useContext, useMemo } from "react";
import { ReadReceipt } from "matrix-js-sdk/src/models/read-receipt";
import MatrixClientContext from "../../../../contexts/MatrixClientContext";
@ -25,6 +25,7 @@ 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);
@ -65,10 +66,12 @@ 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);
const { level, count } = determineUnreadState(room, undefined, !tacEnabled);
const [notificationState] = useNotificationState(room);
return (