about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/api/v1/statuses_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb
index 255c48e62..32f496f03 100644
--- a/app/controllers/api/v1/statuses_controller.rb
+++ b/app/controllers/api/v1/statuses_controller.rb
@@ -36,7 +36,7 @@ class Api::V1::StatusesController < Api::BaseController
   def card
     @card = @status.preview_cards.first
 
-    if @card.nil?
+    if @card.nil? || card_filtered?
       render_empty
     else
       render json: @card, serializer: REST::PreviewCardSerializer, monsterfork_api: monsterfork_api
@@ -116,4 +116,8 @@ class Api::V1::StatusesController < Api::BaseController
   def pagination_params(core_params)
     params.slice(:limit).permit(:limit).merge(core_params)
   end
+
+  def card_filtered?
+    !current_user.nil? && current_user.hides_sensitive_cards? && @status.sensitive?
+  end
 end