user_topic: Add user_topic event.

We now send a new user_topic event while muting and unmuting topics.
fetch_initial_state_data now returns an additional user_topics array to
the client that will maintain the user-topic relationship data.
This will support any future addition of new features to modify the
relationship between a user-topic pair.

This commit adds the relevent backend code and schema for the new
event.
This commit is contained in:
Kartik Srivastava
2022-02-26 02:18:56 +05:30
committed by Tim Abbott
parent 8b674ee3d7
commit 1291e7000b
14 changed files with 264 additions and 16 deletions

View File

@@ -2545,6 +2545,9 @@ class UserTopic(models.Model):
# Implicitly, if a UserTopic does not exist, the (user, topic)
# pair should have normal behavior for that (user, stream) pair.
# We use this in our code to represent the condition in the comment above.
VISIBILITY_POLICY_INHERIT = 0
# A normal muted topic. No notifications and unreads hidden.
MUTED = 1
@@ -2559,6 +2562,7 @@ class UserTopic(models.Model):
(MUTED, "Muted topic"),
(UNMUTED, "Unmuted topic in muted stream"),
(FOLLOWED, "Followed topic"),
(VISIBILITY_POLICY_INHERIT, "User's default policy for the stream."),
)
visibility_policy: int = models.SmallIntegerField(