You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
750 B

  1. # frozen_string_literal: true
  2. class REST::RelationshipSerializer < ActiveModel::Serializer
  3. attributes :id, :following, :followed_by, :blocking,
  4. :muting, :requested, :domain_blocking
  5. def following
  6. instance_options[:relationships].following[object.id] || false
  7. end
  8. def followed_by
  9. instance_options[:relationships].followed_by[object.id] || false
  10. end
  11. def blocking
  12. instance_options[:relationships].blocking[object.id] || false
  13. end
  14. def muting
  15. instance_options[:relationships].muting[object.id] || false
  16. end
  17. def requested
  18. instance_options[:relationships].requested[object.id] || false
  19. end
  20. def domain_blocking
  21. instance_options[:relationships].domain_blocking[object.id] || false
  22. end
  23. end