2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-03 11:03:01 -06:00
|
|
|
class ReviewableUserSerializer < ReviewableSerializer
|
|
|
|
|
2019-04-04 13:45:04 -05:00
|
|
|
attributes :link_admin, :user_fields
|
2019-04-03 16:07:24 -05:00
|
|
|
|
2019-04-03 15:41:04 -05:00
|
|
|
payload_attributes(
|
2019-01-03 11:03:01 -06:00
|
|
|
:username,
|
|
|
|
:email,
|
|
|
|
:name
|
|
|
|
)
|
|
|
|
|
2019-04-03 16:07:24 -05:00
|
|
|
def link_admin
|
|
|
|
scope.is_staff? && object.target.present?
|
|
|
|
end
|
|
|
|
|
2019-04-04 13:45:04 -05: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 11:03:01 -06:00
|
|
|
end
|