notification_policy_serializer.rb 725 B

1234567891011121314151617181920212223242526272829303132
  1. # frozen_string_literal: true
  2. class REST::V1::NotificationPolicySerializer < ActiveModel::Serializer
  3. attributes :filter_not_following,
  4. :filter_not_followers,
  5. :filter_new_accounts,
  6. :filter_private_mentions,
  7. :summary
  8. def summary
  9. {
  10. pending_requests_count: object.pending_requests_count.to_i,
  11. pending_notifications_count: object.pending_notifications_count.to_i,
  12. }
  13. end
  14. def filter_not_following
  15. !object.accept_not_following?
  16. end
  17. def filter_not_followers
  18. !object.accept_not_followers?
  19. end
  20. def filter_new_accounts
  21. !object.accept_new_accounts?
  22. end
  23. def filter_private_mentions
  24. !object.accept_private_mentions?
  25. end
  26. end