Room notification state: add clearer methods, documentation and deprecation (#29564)

* feat(notification state): add clearer methods, documentation and deprecation

* test(room notification state): add tests for new attributes

* doc: more explicit documentation for `hasUnreadCount`

* doc: add link to `RoomNotificationState.isMention` in `hasMentions` doc

* refactor: change `isSilent` to `hasAnyNotificationOrActivity`

* refactor: add `invited` to `determineUnreadState` and use it in `NotificationState` & `RoomNotificationState`

* test: update `RoomNotificationState` test to use `invited`

* test: update other tests to add `invited`

* refactor: remove count check in `isNotification`
This commit is contained in:
Florian Duros
2025-03-24 17:00:47 +01:00
committed by GitHub
parent 13c4ab2cf4
commit a6e8d512d0
6 changed files with 183 additions and 12 deletions
@@ -67,9 +67,9 @@ describe("ImportanceAlgorithm", () => {
};
const unreadStates: Record<string, ReturnType<(typeof RoomNotifs)["determineUnreadState"]>> = {
red: { symbol: null, count: 1, level: NotificationLevel.Highlight },
grey: { symbol: null, count: 1, level: NotificationLevel.Notification },
none: { symbol: null, count: 0, level: NotificationLevel.None },
red: { symbol: null, count: 1, level: NotificationLevel.Highlight, invited: false },
grey: { symbol: null, count: 1, level: NotificationLevel.Notification, invited: false },
none: { symbol: null, count: 0, level: NotificationLevel.None, invited: false },
};
beforeEach(() => {
@@ -77,6 +77,7 @@ describe("ImportanceAlgorithm", () => {
symbol: null,
count: 0,
level: NotificationLevel.None,
invited: false,
});
});
@@ -183,6 +184,7 @@ describe("ImportanceAlgorithm", () => {
symbol: null,
count: 0,
level: NotificationLevel.None,
invited: false,
});
const algorithm = setupAlgorithm(sortAlgorithm);
@@ -353,6 +355,7 @@ describe("ImportanceAlgorithm", () => {
symbol: null,
count: 0,
level: NotificationLevel.None,
invited: false,
});
const algorithm = setupAlgorithm(sortAlgorithm);
@@ -190,6 +190,7 @@ describe("NaturalAlgorithm", () => {
symbol: null,
count: 0,
level: NotificationLevel.None,
invited: false,
});
});