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:
@@ -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";
|
||||
|
||||
@@ -42,6 +42,8 @@ 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, () => {
|
||||
@@ -97,7 +99,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.roomMap.set(room, new RoomNotificationState(room, !this.tacEnabled));
|
||||
}
|
||||
return this.roomMap.get(room)!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user