diff options
Diffstat (limited to 'app/serializers/rest')
-rw-r--r-- | app/serializers/rest/instance_serializer.rb | 2 | ||||
-rw-r--r-- | app/serializers/rest/poll_serializer.rb | 1 | ||||
-rw-r--r-- | app/serializers/rest/preferences_serializer.rb | 30 |
3 files changed, 32 insertions, 1 deletions
diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index 97fed63d1..98c53c84a 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -32,7 +32,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer end def thumbnail - instance_presenter.thumbnail ? full_asset_url(instance_presenter.thumbnail.file.url) : full_pack_url('preview.jpg') + instance_presenter.thumbnail ? full_asset_url(instance_presenter.thumbnail.file.url) : full_pack_url('media/images/preview.jpg') end def max_toot_chars diff --git a/app/serializers/rest/poll_serializer.rb b/app/serializers/rest/poll_serializer.rb index 4dae1c09f..356c45b83 100644 --- a/app/serializers/rest/poll_serializer.rb +++ b/app/serializers/rest/poll_serializer.rb @@ -5,6 +5,7 @@ class REST::PollSerializer < ActiveModel::Serializer :multiple, :votes_count has_many :loaded_options, key: :options + has_many :emojis, serializer: REST::CustomEmojiSerializer attribute :voted, if: :current_user? diff --git a/app/serializers/rest/preferences_serializer.rb b/app/serializers/rest/preferences_serializer.rb new file mode 100644 index 000000000..119f0e06d --- /dev/null +++ b/app/serializers/rest/preferences_serializer.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class REST::PreferencesSerializer < ActiveModel::Serializer + attribute :posting_default_privacy, key: 'posting:default:visibility' + attribute :posting_default_sensitive, key: 'posting:default:sensitive' + attribute :posting_default_language, key: 'posting:default:language' + + attribute :reading_default_sensitive_media, key: 'reading:expand:media' + attribute :reading_default_sensitive_text, key: 'reading:expand:spoilers' + + def posting_default_privacy + object.user.setting_default_privacy + end + + def posting_default_sensitive + object.user.setting_default_sensitive + end + + def posting_default_language + object.user.setting_default_language.presence + end + + def reading_default_sensitive_media + object.user.setting_display_media + end + + def reading_default_sensitive_text + object.user.setting_expand_spoilers + end +end |