Add support for multi-select fields in DiscourseConnect protocol

Continuing the discussion from Custom field in discourseconnect:

While site admins can create multiselect fields in Admin → Customize → User Fields in Discourse, at the moment it’s not possible to populate those fields with multiple values via a DiscourseConnect payload.

The plan is to add support for array params in the SSO payload like:

custom.user_field_1[]=valueA&custom.user_field_1[]=valueB

This almost works but is garbled by this line:

where the Array.to_s means it gets persisted as

 ['valueA', 'valueB'].to_s
=> "[\"valueA\", \"valueB\"]"

Restricting the persisted values to the existing options in the Discourse Admin screen is not necessary.

4 Likes

Love the syntax being proposed here :hugs: go head and make the change to add support for arrays

3 Likes