about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-10-09 19:42:51 -0500
committermultiple creatures <dev@multiple-creature.party>2019-10-09 19:42:51 -0500
commit999ac0672355fe7aa6f57563097a173ed20b99d9 (patch)
treec929634fd5bcf722c1c80981213600ad89ad401f /app/helpers
parentce6a7055159a169ca38162eb2e38825f9331c8d9 (diff)
custom filters can now match media descriptions
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/filter_helper.rb2
1 files changed, 2 insertions, 0 deletions
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?