mirror of
https://github.com/discourse/discourse.git
synced 2026-03-04 01:15:08 +08:00
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.
29 lines
576 B
Ruby
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
|