mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
events: Fix missing empty custom profile data dict for new users.
We were getting event-handling exceptions in JS in production if a new user was created and then went and set a custom profile field, because there was no `.profile_data` on their user object. We were able to trace the issue down to the fact that our events didn't include that field when creating a new user.
This commit is contained in:
@@ -478,7 +478,9 @@ def notify_created_user(user_profile: UserProfile) -> None:
|
|||||||
avatar_url=avatar_url(user_profile),
|
avatar_url=avatar_url(user_profile),
|
||||||
timezone=user_profile.timezone,
|
timezone=user_profile.timezone,
|
||||||
date_joined=user_profile.date_joined.isoformat(),
|
date_joined=user_profile.date_joined.isoformat(),
|
||||||
is_bot=user_profile.is_bot))
|
is_bot=user_profile.is_bot)) # type: Dict[str, Any]
|
||||||
|
if not user_profile.is_bot:
|
||||||
|
event["person"]["profile_data"] = {}
|
||||||
send_event(event, active_user_ids(user_profile.realm_id))
|
send_event(event, active_user_ids(user_profile.realm_id))
|
||||||
|
|
||||||
def created_bot_event(user_profile: UserProfile) -> Dict[str, Any]:
|
def created_bot_event(user_profile: UserProfile) -> Dict[str, Any]:
|
||||||
|
|||||||
@@ -1144,6 +1144,7 @@ class EventsRegisterTest(ZulipTestCase):
|
|||||||
('full_name', check_string),
|
('full_name', check_string),
|
||||||
('is_admin', check_bool),
|
('is_admin', check_bool),
|
||||||
('is_bot', check_bool),
|
('is_bot', check_bool),
|
||||||
|
('profile_data', check_dict_only([])),
|
||||||
('timezone', check_string),
|
('timezone', check_string),
|
||||||
('date_joined', check_string),
|
('date_joined', check_string),
|
||||||
])),
|
])),
|
||||||
|
|||||||
Reference in New Issue
Block a user