diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-08-15 22:40:20 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-08-15 22:40:20 -0500 |
commit | 7bbcf793bc75b44f2b20de77b7774759af60cd90 (patch) | |
tree | d8d441c2d8cf245b28651efa14f6460841a8e304 /app/controllers | |
parent | f783ec279d03b7b56c96af5e18e0dd8c7a0710a1 (diff) |
custom filters now have an option to add or override content warnings; filter caching has been fixed
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/api/v1/filters_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/api/v1/statuses_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/filters_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/statuses_controller.rb | 4 |
4 files changed, 9 insertions, 2 deletions
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 diff --git a/app/controllers/filters_controller.rb b/app/controllers/filters_controller.rb index 55ee05833..c58da753b 100644 --- a/app/controllers/filters_controller.rb +++ b/app/controllers/filters_controller.rb @@ -58,7 +58,7 @@ class FiltersController < ApplicationController end def resource_params - params.require(:custom_filter).permit(:phrase, :expires_in, :irreversible, :whole_word, :exclude_media, :spoiler, :tags, :thread, :media_only, context: []) + params.require(:custom_filter).permit(:phrase, :expires_in, :irreversible, :whole_word, :exclude_media, :media_only, :status_text, :spoiler, :tags, :custom_cw, :override_cw, context: []) end def set_body_classes diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb index 6fd937f8d..7af237da4 100644 --- a/app/controllers/statuses_controller.rb +++ b/app/controllers/statuses_controller.rb @@ -3,6 +3,7 @@ class StatusesController < ApplicationController include SignatureAuthentication include Authorization + include FilterHelper ANCESTORS_LIMIT = 40 DESCENDANTS_LIMIT = 60 @@ -192,6 +193,9 @@ class StatusesController < ApplicationController @type = @stream_entry.activity_type.downcase @sharekey = params[:key] + # make sure any custom cws are applied + phrase_filtered?(@status, current_account.id, 'thread') unless current_account.nil? + if @status.sharekey.present? && @sharekey == @status.sharekey skip_authorization else |