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:
Tim Abbott
2018-07-31 10:53:56 -07:00
parent d377ac5768
commit 1b2a26ca83
2 changed files with 4 additions and 1 deletions

View File

@@ -478,7 +478,9 @@ def notify_created_user(user_profile: UserProfile) -> None:
avatar_url=avatar_url(user_profile),
timezone=user_profile.timezone,
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))
def created_bot_event(user_profile: UserProfile) -> Dict[str, Any]: