From 7bbcf793bc75b44f2b20de77b7774759af60cd90 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Thu, 15 Aug 2019 22:40:20 -0500 Subject: custom filters now have an option to add or override content warnings; filter caching has been fixed --- app/controllers/api/v1/filters_controller.rb | 2 +- app/controllers/api/v1/statuses_controller.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app/controllers/api') diff --git a/app/controllers/api/v1/filters_controller.rb b/app/controllers/api/v1/filters_controller.rb index 48177f41a..760218d62 100644 --- a/app/controllers/api/v1/filters_controller.rb +++ b/app/controllers/api/v1/filters_controller.rb @@ -43,6 +43,6 @@ class Api::V1::FiltersController < Api::BaseController end def resource_params - params.permit(:phrase, :expires_in, :irreversible, :whole_word, :exclude_media, :media_only, :status_text, :spoiler, :tags, context: []) + params.permit(:phrase, :expires_in, :irreversible, :whole_word, :exclude_media, :media_only, :status_text, :spoiler, :tags, :custom_cw, :override_cw, context: []) end end diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index fa3483822..a5ea12591 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -2,6 +2,7 @@ class Api::V1::StatusesController < Api::BaseController include Authorization + include FilterHelper before_action -> { authorize_if_got_token! :read, :'read:statuses' }, except: [:create, :destroy] before_action -> { doorkeeper_authorize! :write, :'write:statuses' }, only: [:create, :destroy] @@ -18,6 +19,8 @@ class Api::V1::StatusesController < Api::BaseController def show @status = cache_collection([@status], Status).first + # make sure any custom cws are applied + phrase_filtered?(@status, current_account.id, 'thread') unless current_account.nil? render json: @status, serializer: REST::StatusSerializer end -- cgit