credential_account_serializer.rb 475 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class REST::CredentialAccountSerializer < REST::AccountSerializer
  3. attributes :source
  4. def source
  5. user = object.user
  6. {
  7. privacy: user.setting_default_privacy,
  8. sensitive: user.setting_default_sensitive,
  9. language: user.setting_default_language,
  10. note: object.note,
  11. fields: object.fields.map(&:to_h),
  12. follow_requests_count: FollowRequest.where(target_account: object).limit(40).count,
  13. }
  14. end
  15. end