闭社主体 forked from https://github.com/tootsuite/mastodon
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
875 B

  1. # frozen_string_literal: true
  2. class REST::PreferencesSerializer < ActiveModel::Serializer
  3. attribute :posting_default_privacy, key: 'posting:default:visibility'
  4. attribute :posting_default_sensitive, key: 'posting:default:sensitive'
  5. attribute :posting_default_language, key: 'posting:default:language'
  6. attribute :reading_default_sensitive_media, key: 'reading:expand:media'
  7. attribute :reading_default_sensitive_text, key: 'reading:expand:spoilers'
  8. def posting_default_privacy
  9. object.user.setting_default_privacy
  10. end
  11. def posting_default_sensitive
  12. object.user.setting_default_sensitive
  13. end
  14. def posting_default_language
  15. object.user.setting_default_language.presence
  16. end
  17. def reading_default_sensitive_media
  18. object.user.setting_display_media
  19. end
  20. def reading_default_sensitive_text
  21. object.user.setting_expand_spoilers
  22. end
  23. end