Skip calculating unread push actions in /sync when enable_push is false. (#14980)

This commit is contained in:
Erik Johnston 2023-02-14 12:10:29 +01:00 committed by GitHub
parent db2b105d69
commit f09db5c991
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View file

@ -203,11 +203,18 @@ class RoomNotifCounts:
# Map of thread ID to the notification counts.
threads: Dict[str, NotifCounts]
@staticmethod
def empty() -> "RoomNotifCounts":
return _EMPTY_ROOM_NOTIF_COUNTS
def __len__(self) -> int:
# To properly account for the amount of space in any caches.
return len(self.threads) + 1
_EMPTY_ROOM_NOTIF_COUNTS = RoomNotifCounts(NotifCounts(), {})
def _serialize_action(
actions: Collection[Union[Mapping, str]], is_highlight: bool
) -> str: