2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-03 12:03:01 -05:00
|
|
|
class ReviewableUserSerializer < ReviewableSerializer
|
|
|
|
|
2019-04-04 14:45:04 -04:00
|
|
|
attributes :link_admin, :user_fields
|
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,
|
|
|
|
:name
|
|
|
|
)
|
|
|
|
|
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
|