profile: Send field types to client side.

This commit is contained in:
Umair Khan 2017-12-14 09:49:19 +05:00 committed by Tim Abbott
parent f6fb88549f
commit 7885dd4408
2 changed files with 3 additions and 1 deletions

View File

@ -44,7 +44,7 @@ from zerver.models import Client, Message, Realm, UserPresence, UserProfile, Cus
get_user_profile_by_id, \ get_user_profile_by_id, \
get_realm_user_dicts, realm_filters_for_realm, get_user,\ get_realm_user_dicts, realm_filters_for_realm, get_user,\
custom_profile_fields_for_realm, get_realm_domains, \ custom_profile_fields_for_realm, get_realm_domains, \
get_default_stream_groups get_default_stream_groups, CustomProfileField
from zproject.backends import email_auth_enabled, password_auth_enabled from zproject.backends import email_auth_enabled, password_auth_enabled
from version import ZULIP_VERSION from version import ZULIP_VERSION
@ -124,6 +124,7 @@ def fetch_initial_state_data(user_profile: UserProfile,
if want('custom_profile_fields'): if want('custom_profile_fields'):
fields = custom_profile_fields_for_realm(user_profile.realm.id) fields = custom_profile_fields_for_realm(user_profile.realm.id)
state['custom_profile_fields'] = [f.as_dict() for f in fields] state['custom_profile_fields'] = [f.as_dict() for f in fields]
state['custom_profile_field_types'] = CustomProfileField.FIELD_TYPE_CHOICES
if want('attachments'): if want('attachments'):
state['attachments'] = user_attachments(user_profile) state['attachments'] = user_attachments(user_profile)

View File

@ -51,6 +51,7 @@ class HomeTest(ZulipTestCase):
"bot_types", "bot_types",
"can_create_streams", "can_create_streams",
"cross_realm_bots", "cross_realm_bots",
"custom_profile_field_types",
"custom_profile_fields", "custom_profile_fields",
"debug_mode", "debug_mode",
"default_desktop_notifications", "default_desktop_notifications",