custom_profile_fields: Add "display_in_profile_summary" field in model.

To allow `custom_profile_field` to display in user profile popover,
added new boolean field "display_in_profile_summary" in its model class.

In `custom_profile_fields.py`, functions are edited as per conditions,
like currently we can display max 2 `custom_profile_fields` except
`LONG_TEXT` and `USER` type fields.

Default external account custom profile fields made updatable for only
this new field, as previous they were not updatable.

Fixes part of: #21215
This commit is contained in:
yogesh sirsat
2022-07-13 00:34:47 +05:30
committed by Tim Abbott
parent 2e9cd20380
commit 543f36b7da
11 changed files with 234 additions and 17 deletions

View File

@@ -171,6 +171,9 @@ custom_profile_field_type = DictType(
("field_data", str),
("order", int),
],
optional_keys=[
("display_in_profile_summary", bool),
],
)
custom_profile_fields_event = event_dict_type(

View File

@@ -29,11 +29,12 @@ RealmUserValidator = Callable[[int, object, bool], List[int]]
ProfileDataElementValue = Union[str, List[int]]
class ProfileDataElementBase(TypedDict):
class ProfileDataElementBase(TypedDict, total=False):
id: int
name: str
type: int
hint: str
display_in_profile_summary: bool
field_data: str
order: int