mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
custom_profile_fields: Use strings as dict keys.
JSON keys must be strings, and orjson enforces this. Mypy didn’t catch the mismatched type of profiles_by_user_id because it doesn’t understand CustomProfileFieldValue.field_id. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
b250e42f61
commit
44af001045
@@ -476,12 +476,12 @@ def apply_event(state: Dict[str, Any],
|
||||
custom_field_id = person['custom_profile_field']['id']
|
||||
custom_field_new_value = person['custom_profile_field']['value']
|
||||
if 'rendered_value' in person['custom_profile_field']:
|
||||
p['profile_data'][custom_field_id] = {
|
||||
p['profile_data'][str(custom_field_id)] = {
|
||||
'value': custom_field_new_value,
|
||||
'rendered_value': person['custom_profile_field']['rendered_value'],
|
||||
}
|
||||
else:
|
||||
p['profile_data'][custom_field_id] = {
|
||||
p['profile_data'][str(custom_field_id)] = {
|
||||
'value': custom_field_new_value,
|
||||
}
|
||||
|
||||
|
||||
@@ -431,12 +431,12 @@ def get_custom_profile_field_values(custom_profile_field_values:
|
||||
for profile_field in custom_profile_field_values:
|
||||
user_id = profile_field.user_profile_id
|
||||
if profile_field.field.is_renderable():
|
||||
profiles_by_user_id[user_id][profile_field.field_id] = {
|
||||
profiles_by_user_id[user_id][str(profile_field.field_id)] = {
|
||||
"value": profile_field.value,
|
||||
"rendered_value": profile_field.rendered_value,
|
||||
}
|
||||
else:
|
||||
profiles_by_user_id[user_id][profile_field.field_id] = {
|
||||
profiles_by_user_id[user_id][str(profile_field.field_id)] = {
|
||||
"value": profile_field.value,
|
||||
}
|
||||
return profiles_by_user_id
|
||||
|
||||
Reference in New Issue
Block a user