Fix display of changed avatars in old messages (page_params).

Our client code will now receive avatar_url in
page_params.people_list during page load, so it will be
able to use more current urls for old messages (the client
already had some logic for that and was just missing the
data).

We also add avatar_url to the realm_user/add event.

When we change the avatar, we make sure to always send a
realm_user/update event (even for bots).

We also needed to add avatar_version and
avatar_source to our active users cache.
This commit is contained in:
Steve Howell
2017-02-21 08:55:32 -08:00
parent 8de72184e1
commit fa31ad35c9
4 changed files with 25 additions and 18 deletions

View File

@@ -356,6 +356,7 @@ def notify_created_user(user_profile):
user_id=user_profile.id,
is_admin=user_profile.is_realm_admin,
full_name=user_profile.full_name,
avatar_url=avatar_url(user_profile),
is_bot=user_profile.is_bot))
send_event(event, active_user_ids(user_profile.realm))
@@ -1915,17 +1916,17 @@ def do_change_avatar_fields(user_profile, avatar_source, log=True):
avatar_url=avatar_url(user_profile),
)),
bot_owner_userids(user_profile))
else:
payload = dict(
email=user_profile.email,
avatar_url=avatar_url(user_profile),
user_id=user_profile.id
)
send_event(dict(type='realm_user',
op='update',
person=payload),
active_user_ids(user_profile.realm))
payload = dict(
email=user_profile.email,
avatar_url=avatar_url(user_profile),
user_id=user_profile.id
)
send_event(dict(type='realm_user',
op='update',
person=payload),
active_user_ids(user_profile.realm))
def _default_stream_permision_check(user_profile, stream):
# type: (UserProfile, Optional[Stream]) -> None