From 38c88fd8e84aed59a151126efb2139b6d34a3d36 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Thu, 13 Feb 2020 16:18:19 -0600 Subject: check user's sensitive card filter setting in the status controller --- app/controllers/api/v1/statuses_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/controllers/api/v1') 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 -- cgit