2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/app/serializers/user_field_serializer.rb
Ted Johansson b36747163b
FEATURE: Allow hiding user fields on signup form (#34672)
We want to allow configuring fields that are both optional and editable to not show up in the signup form.

- Fields that are optional but not editable need to be on the signup form, or they can never be filled in.
- Fields that are not optional need to be on the signup form, or you can never sign up.
2025-09-15 10:42:07 +08:00

29 lines
576 B
Ruby

# frozen_string_literal: true
class UserFieldSerializer < ApplicationSerializer
attributes :id,
:name,
:description,
:field_type,
:editable,
:required,
:requirement,
:show_on_profile,
:show_on_user_card,
:show_on_signup,
:searchable,
:position,
:options
def required
object.required?
end
def options
object.user_field_options.pluck(:value)
end
def include_options?
options.present?
end
end