2014-07-28 13:17:37 -04:00
|
|
|
class FlaggedUserSerializer < BasicUserSerializer
|
|
|
|
attributes :can_delete_all_posts,
|
|
|
|
:can_be_deleted,
|
|
|
|
:post_count,
|
|
|
|
:topic_count,
|
2018-06-13 11:44:13 -04:00
|
|
|
:ip_address,
|
|
|
|
:custom_fields
|
2014-07-28 13:17:37 -04:00
|
|
|
|
|
|
|
def can_delete_all_posts
|
|
|
|
scope.can_delete_all_posts?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_be_deleted
|
|
|
|
scope.can_delete_user?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def ip_address
|
|
|
|
object.ip_address.try(:to_s)
|
|
|
|
end
|
|
|
|
|
2018-06-13 11:44:13 -04:00
|
|
|
def custom_fields
|
|
|
|
fields = User.whitelisted_user_custom_fields(scope)
|
|
|
|
|
2018-06-14 09:22:42 -04:00
|
|
|
result = {}
|
|
|
|
fields.each do |k|
|
|
|
|
result[k] = object.custom_fields[k] if object.custom_fields[k].present?
|
2018-06-13 11:44:13 -04:00
|
|
|
end
|
|
|
|
|
2018-06-14 09:22:42 -04:00
|
|
|
result
|
2018-06-13 11:44:13 -04:00
|
|
|
end
|
|
|
|
|
2014-07-28 13:17:37 -04:00
|
|
|
end
|