mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
Add unread_msgs to the initial state data.
We are adding a new list of unread message ids grouped by conversation to the queue registration result. This will allow clients to show accurate unread badges without needing to load an unbound number of historic messages. Jason started this commit, and then Steve Howell finished it. We only identify conversations using stream_id/user_id info; we may need a subsequent version that includes things like stream names and user emails/names for API clients that don't have data structures to map ids -> attributes.
This commit is contained in:
committed by
Tim Abbott
parent
04729a0e79
commit
4f0110e081
@@ -1272,6 +1272,14 @@ class AbstractUserMessage(ModelReprMixin, models.Model):
|
||||
abstract = True
|
||||
unique_together = ("user_profile", "message")
|
||||
|
||||
@staticmethod
|
||||
def where_unread():
|
||||
# type: () -> str
|
||||
# Use this for Django ORM queries where we are getting lots
|
||||
# of rows. This customer SQL plays nice with our partial indexes.
|
||||
# Grep the code for example usage.
|
||||
return 'flags & 1 = 0'
|
||||
|
||||
def flags_list(self):
|
||||
# type: () -> List[str]
|
||||
return [flag for flag in self.flags.keys() if getattr(self.flags, flag).is_set]
|
||||
|
||||
Reference in New Issue
Block a user