diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/v1/filters_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/filters_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/filter_helper.rb | 2 | ||||
-rw-r--r-- | app/models/custom_filter.rb | 1 | ||||
-rw-r--r-- | app/views/filters/_fields.html.haml | 1 |
5 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/api/v1/filters_controller.rb b/app/controllers/api/v1/filters_controller.rb index 6cba4b23f..6b8b82285 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, :whole_word, :exclude_media, :media_only, :status_text, :spoiler, :tags, :custom_cw, :override_cw, context: []) + params.permit(:phrase, :expires_in, :whole_word, :exclude_media, :media_only, :status_text, :spoiler, :tags, :custom_cw, :override_cw, :desc, context: []) end end diff --git a/app/controllers/filters_controller.rb b/app/controllers/filters_controller.rb index c58da753b..c80e6853a 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, :media_only, :status_text, :spoiler, :tags, :custom_cw, :override_cw, context: []) + params.require(:custom_filter).permit(:phrase, :expires_in, :irreversible, :whole_word, :exclude_media, :media_only, :status_text, :spoiler, :tags, :custom_cw, :override_cw, :desc, context: []) end def set_body_classes diff --git a/app/helpers/filter_helper.rb b/app/helpers/filter_helper.rb index 079075a97..3e3b4b748 100644 --- a/app/helpers/filter_helper.rb +++ b/app/helpers/filter_helper.rb @@ -24,6 +24,7 @@ module FilterHelper status_text = Formatter.instance.plaintext(status) spoiler_text = status.spoiler_text tags = status.tags.pluck(:name).join("\n") + descs = status.media_attachments.map { |a| a.description }.join("\n").strip filters.each do |filter| if filter.whole_word @@ -39,6 +40,7 @@ module FilterHelper matched ||= regex.match(status_text).present? if filter.status_text matched ||= regex.match(spoiler_text).present? if filter.spoiler && spoiler_text.present? matched ||= regex.match(tags).present? if filter.tags && tags.present? + matched ||= regex.match(descs).present? if filter.desc && descs.present? if matched filter_thread(receiver_id, status.conversation_id) if filter.thread && filter.custom_cw.blank? diff --git a/app/models/custom_filter.rb b/app/models/custom_filter.rb index ddf6cc7ab..fb269d8f4 100644 --- a/app/models/custom_filter.rb +++ b/app/models/custom_filter.rb @@ -20,6 +20,7 @@ # status_text :boolean default(FALSE), not null # custom_cw :text # override_cw :boolean default(FALSE), not null +# desc :boolean default(FALSE), not null # class CustomFilter < ApplicationRecord diff --git a/app/views/filters/_fields.html.haml b/app/views/filters/_fields.html.haml index 27561c466..6389e11b1 100644 --- a/app/views/filters/_fields.html.haml +++ b/app/views/filters/_fields.html.haml @@ -16,6 +16,7 @@ = f.input :status_text, wrapper: :with_label = f.input :spoiler, wrapper: :with_label = f.input :tags, wrapper: :with_label + = f.input :desc, wrapper: :with_label = f.input :thread, wrapper: :with_label = f.input :media_only, wrapper: :with_label = f.input :exclude_media, wrapper: :with_label |