Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
custom_profile: Use cast to ensure ProfieDataElementUpdateDict.
Zixuan James Li00f2040ffadc
diff --git a/zerver/views/custom_profile_fields.py b/zerver/views/custom_profile_fields.pyindex f36bd1bf25c..9e281628f72 100644--- a/zerver/views/custom_profile_fields.py+++ b/zerver/views/custom_profile_fields.py@@ -1,4 +1,4 @@-from typing import Dict, List, Union+from typing import List, castimport orjsonfrom django.core.exceptions import ValidationError@@ -20,7 +20,7 @@ from zerver.lib.exceptions import JsonableErrorfrom zerver.lib.external_accounts import validate_external_account_field_datafrom zerver.lib.request import REQ, has_request_variablesfrom zerver.lib.response import json_success-from zerver.lib.types import ProfileDataElementValue, ProfileFieldData, Validator+from zerver.lib.types import ProfileDataElementUpdateDict, ProfileFieldData, Validatorfrom zerver.lib.users import validate_user_custom_profile_datafrom zerver.lib.validator import (check_capped_string,@@ -197,19 +197,25 @@ def remove_user_custom_profile_data(return json_success(request)+check_profile_data_element_update_dict = cast(+ Validator[ProfileDataElementUpdateDict],+ check_dict_only(+ [+ ("id", check_int),+ ("value", check_union([check_string, check_list(check_int)])),+ ]+ ),+)++@human_users_only@has_request_variablesdef update_user_custom_profile_data(request: HttpRequest,user_profile: UserProfile,- data: List[Dict[str, Union[int, ProfileDataElementValue]]] = REQ(+ data: List[ProfileDataElementUpdateDict] = REQ(json_validator=check_list(- check_dict_only(- [- ("id", check_int),- ("value", check_union([check_string, check_list(check_int)])),- ]- ),+ check_profile_data_element_update_dict,)),) -> HttpResponse: