home.py: move user_profile email to register_ret.

Move the user_profile data section down into fetch_initial_state_data so
it entirely pulls from register_ret for #3853
This commit is contained in:
fionabunny 2017-04-26 15:24:54 -07:00 committed by Tim Abbott
parent 9daf9faa5c
commit d5421f25e1
2 changed files with 3 additions and 2 deletions

View File

@ -136,6 +136,7 @@ def fetch_initial_state_data(user_profile, event_types, queue_id,
state['is_admin'] = user_profile.is_realm_admin
state['user_id'] = user_profile.id
state['enter_sends'] = user_profile.enter_sends
state['email'] = user_profile.email
if want('realm_bot'):
state['realm_bots'] = get_owned_bot_dicts(user_profile)
@ -237,7 +238,7 @@ def apply_event(state, event, user_profile, include_subscribers):
del person['avatar_source']
del person['avatar_url_medium']
for field in ['is_admin']:
for field in ['is_admin', 'email']:
if person['user_id'] == user_profile.id and field in person and field in state:
state[field] = person[field]

View File

@ -207,7 +207,6 @@ def home_real(request):
# user_profile data.
# TODO: Move all of these data to register_ret and pull from there
fullname = user_profile.full_name,
email = user_profile.email,
# Realm foreign key data from register_ret.
# TODO: Rename these to match register_ret values.
@ -242,6 +241,7 @@ def home_real(request):
'can_create_streams',
'default_desktop_notifications',
'default_language',
'email',
'emoji_alt_code',
'emojiset',
'emojiset_choices',