diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-02-13 15:32:43 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-02-13 15:32:43 -0600 |
commit | 1435ebec8fede44289a1c8a9213ff336c614f68d (patch) | |
tree | 6ed2f09f554eca5463aca20d7d11893f0d32c8ee /app/serializers/rest | |
parent | 362d6a8e4c1f3224f89ff0a2f109b404bb049017 (diff) |
(reso: report #201) add option to strip embed cards from sensitive posts, make default
Diffstat (limited to 'app/serializers/rest')
-rw-r--r-- | app/serializers/rest/status_serializer.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index de8d08528..931904636 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -32,7 +32,7 @@ class REST::StatusSerializer < ActiveModel::Serializer has_many :tags has_many :emojis, serializer: REST::CustomEmojiSerializer - has_one :preview_card, key: :card, serializer: REST::PreviewCardSerializer + has_one :preview_card, key: :card, serializer: REST::PreviewCardSerializer, if: :card_not_filtered? has_one :preloadable_poll, key: :poll, serializer: REST::PollSerializer def trans @@ -152,6 +152,10 @@ class REST::StatusSerializer < ActiveModel::Serializer instance_options[:source_requested] end + def card_not_filtered? + !(current_user? && current_user.hides_sensitive_cards? && object.sensitive?) + end + def ordered_mentions object.active_mentions.to_a.sort_by(&:id) end |