user_status: Add backend changes to support status emoji.

In this commit:

* We update the `UserStatus` model to accept
`AbstractReaction` as a base class so, we can get all the
fields related to store status emoji.

* We update the user status endpoint
(`users/me/status`) to accept status emoji fields.

* We update the user status event to add status emoji
fields.

Co-authored-by: Yash Rathore <33805964+YashRE42@users.noreply.github.com>
This commit is contained in:
Riken Shah
2021-06-22 16:42:31 +00:00
committed by Tim Abbott
parent ed01ffadba
commit 9fadd43830
10 changed files with 330 additions and 48 deletions

View File

@@ -5401,7 +5401,13 @@ def update_user_presence(
def do_update_user_status(
user_profile: UserProfile, away: Optional[bool], status_text: Optional[str], client_id: int
user_profile: UserProfile,
away: Optional[bool],
status_text: Optional[str],
client_id: int,
emoji_name: Optional[str],
emoji_code: Optional[str],
reaction_type: Optional[str],
) -> None:
if away is None:
status = None
@@ -5417,6 +5423,9 @@ def do_update_user_status(
status=status,
status_text=status_text,
client_id=client_id,
emoji_name=emoji_name,
emoji_code=emoji_code,
reaction_type=reaction_type,
)
event = dict(
@@ -5430,6 +5439,10 @@ def do_update_user_status(
if status_text is not None:
event["status_text"] = status_text
if emoji_name is not None:
event["emoji_name"] = emoji_name
event["emoji_code"] = emoji_code
event["reaction_type"] = reaction_type
send_event(realm, event, active_user_ids(realm.id))