mirror of
https://github.com/discourse/discourse.git
synced 2024-12-21 08:33:43 +08:00
7b437c9401
We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
29 lines
546 B
Ruby
29 lines
546 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,
|
|
:searchable,
|
|
:position,
|
|
:options
|
|
|
|
def required
|
|
object.required?
|
|
end
|
|
|
|
def options
|
|
object.user_field_options.pluck(:value)
|
|
end
|
|
|
|
def include_options?
|
|
options.present?
|
|
end
|
|
end
|