描述
Currently, Zulip's custom profile fields feature has a bunch of field types, but none of them are appropriate for selecting a set of values from a larger set (E.g. a set of parts of an open source project that one is involved in).
This seems like a generically useful idea; I think there's probably 2 variants that make sense: One where anyone can add additional values (e.g. a "tags" feature), and another where only administrators can add potential values. I'd start with the only-administrators case; it's possible that we'll want to build "Anyone can add values" as a toggle that applies to both this as the "normal" choices field type in some common way. We can call this SELECT_MULTIPLE in the code, though I think that doesn't get exposed to the API or use, and thus is easy to change later. (We may want to rename s/CHOICE/SELECT/ as a prep commit for consistency/readability; CHOICE has always struck me as a little imprecise).
At the API layer, we'll probably want to encode these similarly to the choices field type, just using a List[int] instead of an int. I haven't thought through how the models.py logic should work, but probably we just want to store the List[int] JSON-encoded in the CustomProfileFieldValue.value field.
I think while working on this, we should make an effort to add documentation that makes it easier to trace how specific CustomProfileField types are put together, maybe just a nice set of comments in the models.py section that defines these. E.g. I found it kinda slow to check that a CustomProfileField.CHOICE field has the format of its val an integer.
See https://chat.zulip.org/#narrow/stream/9-issues/topic/Feature.20request.3A.20Custom.20profile.20lists.20multi-select.20mode/near/1123992 for the original feature request.