2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-04 01:03:01 +08:00
|
|
|
class ReviewableUserSerializer < ReviewableSerializer
|
|
|
|
|
2021-01-15 06:43:26 +08:00
|
|
|
attributes :link_admin, :user_fields, :reject_reason
|
2019-04-04 05:07:24 +08:00
|
|
|
|
2019-04-04 04:41:04 +08:00
|
|
|
payload_attributes(
|
2019-01-04 01:03:01 +08:00
|
|
|
:username,
|
|
|
|
:email,
|
2020-01-30 02:38:27 +08:00
|
|
|
:name,
|
|
|
|
:bio,
|
|
|
|
:website
|
2019-01-04 01:03:01 +08:00
|
|
|
)
|
|
|
|
|
2019-04-04 05:07:24 +08:00
|
|
|
def link_admin
|
|
|
|
scope.is_staff? && object.target.present?
|
|
|
|
end
|
|
|
|
|
2019-04-05 02:45:04 +08:00
|
|
|
def user_fields
|
|
|
|
object.target.user_fields
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_user_fields?
|
|
|
|
object.target.present? && object.target.user_fields.present?
|
|
|
|
end
|
|
|
|
|
2019-01-04 01:03:01 +08:00
|
|
|
end
|