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

@ -81,7 +81,7 @@ describe("RoomNotificationState", () => {
}
it("Updates on event decryption", () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, true);
const listener = jest.fn();
roomNotifState.addListener(NotificationStateEvents.Update, listener);
const testEvent = {
@ -93,12 +93,12 @@ describe("RoomNotificationState", () => {
});
it("removes listeners", () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, false);
expect(() => roomNotifState.destroy()).not.toThrow();
});
it("suggests an 'unread' ! if there are unsent messages", () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, false);
const event = mkEvent({
event: true,
@ -115,7 +115,7 @@ describe("RoomNotificationState", () => {
});
it("suggests nothing if the room is muted", () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, false);
muteRoom(room);
setUnreads(room, 1234, 0);
@ -127,7 +127,7 @@ describe("RoomNotificationState", () => {
});
it("suggests a red ! if the user has been invited to a room", () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, false);
room.updateMyMembership("invite"); // emit
@ -137,7 +137,7 @@ describe("RoomNotificationState", () => {
});
it("returns a proper count and color for regular unreads", () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, false);
setUnreads(room, 4321, 0);
room.updateMyMembership("join"); // emit
@ -148,7 +148,7 @@ describe("RoomNotificationState", () => {
});
it("returns a proper count and color for highlights", () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, false);
setUnreads(room, 0, 69);
room.updateMyMembership("join"); // emit
@ -159,7 +159,7 @@ describe("RoomNotificationState", () => {
});
it("includes threads", async () => {
const roomNotifState = new RoomNotificationState(room);
const roomNotifState = new RoomNotificationState(room, true);
room.timeline.push(
new MatrixEvent({