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:
Anders Kaseorg
2020-08-06 18:24:19 -07:00
committed by Tim Abbott
parent b250e42f61
commit 44af001045
2 changed files with 4 additions and 4 deletions

View File

@@ -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