home: Remove now-unnecessary page_params_core_fields duplication.

Also, we update the documentation to make the overall system a bit
clearer.

Fixes #4628.
This commit is contained in:
Tim Abbott
2017-05-13 22:49:35 -07:00
parent 157e0623f8
commit 97abaae9af
4 changed files with 25 additions and 105 deletions

View File

@@ -220,87 +220,10 @@ def home_real(request):
has_mobile_devices = num_push_devices_for_user(user_profile) > 0,
)
# These fields will be automatically copied from register_ret into
# page_params. It is a goal to move more of the page_params list
# into this sort of cleaner structure.
page_params_core_fields = [
'alert_words',
'attachments',
'autoscroll_forever',
'avatar_source',
'avatar_url',
'avatar_url_medium',
'can_create_streams',
'default_desktop_notifications',
'default_language',
'email',
'emoji_alt_code',
'emojiset',
'emojiset_choices',
'enable_desktop_notifications',
'enable_digest_emails',
'enable_offline_email_notifications',
'enable_offline_push_notifications',
'enable_online_push_notifications',
'enable_sounds',
'enable_stream_desktop_notifications',
'enable_stream_sounds',
'enter_sends',
'full_name',
'hotspots',
'is_admin',
'last_event_id',
'left_side_userlist',
'max_icon_file_size',
'max_message_id',
'muted_topics',
'never_subscribed',
'pm_content_in_desktop_notifications',
'pointer',
'presences',
'queue_id',
'realm_add_emoji_by_admins_only',
'realm_allow_message_editing',
'realm_authentication_methods',
'realm_bot_domain',
'realm_bots',
'realm_create_stream_by_admins_only',
'realm_default_language',
'realm_default_streams',
'realm_domains',
'realm_email_changes_disabled',
'realm_emoji',
'realm_filters',
'realm_icon_source',
'realm_icon_url',
'realm_invite_by_admins_only',
'realm_inline_image_preview',
'realm_inline_url_embed_preview',
'realm_invite_required',
'realm_is_zephyr_mirror_realm',
'realm_mandatory_topics',
'realm_message_content_edit_limit_seconds',
'realm_message_retention_days',
'realm_name',
'realm_description',
'realm_name_changes_disabled',
'realm_password_auth_enabled',
'realm_presence_disabled',
'realm_restricted_to_domain',
'realm_show_digest_email',
'realm_uri',
'realm_users',
'realm_waiting_period_threshold',
'referrals',
'subscriptions',
'unsubscribed',
'timezone',
'twenty_four_hour_time',
'user_id',
'zulip_version',
undesired_register_ret_fields = [
'streams',
]
for field_name in page_params_core_fields:
for field_name in set(register_ret.keys()) - set(undesired_register_ret_fields):
page_params[field_name] = register_ret[field_name]
if narrow_stream is not None: