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