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

@ -25,7 +25,10 @@ import { NotificationState } from "./NotificationState";
import SettingsStore from "../../settings/SettingsStore";
export class RoomNotificationState extends NotificationState implements IDestroyable {
public constructor(public readonly room: Room) {
public constructor(
public readonly room: Room,
private includeThreads: boolean,
) {
super();
const cli = this.room.client;
this.room.on(RoomEvent.Receipt, this.handleReadReceipt);
@ -90,7 +93,7 @@ export class RoomNotificationState extends NotificationState implements IDestroy
private updateNotificationState(): void {
const snapshot = this.snapshot();
const { level, symbol, count } = RoomNotifs.determineUnreadState(this.room);
const { level, symbol, count } = RoomNotifs.determineUnreadState(this.room, undefined, this.includeThreads);
const muted =
RoomNotifs.getRoomNotifsState(this.room.client, this.room.roomId) === RoomNotifs.RoomNotifState.Mute;
const knocked = SettingsStore.getValue("feature_ask_to_join") && this.room.getMyMembership() === "knock";