mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 04:53:58 +08:00
4a4406de8c
This code was in here previously but some columns were included that were not used.
33 lines
643 B
Ruby
33 lines
643 B
Ruby
class FlaggedUserSerializer < BasicUserSerializer
|
|
attributes :can_delete_all_posts,
|
|
:can_be_deleted,
|
|
:post_count,
|
|
:topic_count,
|
|
:ip_address,
|
|
:custom_fields
|
|
|
|
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
|
|
|
|
def custom_fields
|
|
fields = User.whitelisted_user_custom_fields(scope)
|
|
|
|
result = {}
|
|
fields.each do |k|
|
|
result[k] = object.custom_fields[k] if object.custom_fields[k].present?
|
|
end
|
|
|
|
result
|
|
end
|
|
|
|
end
|