about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-04-27 19:19:32 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:22 -0500
commit26d90a36ff07aa905db63985886d5c08c934b7b6 (patch)
tree4a4ac8b60bcd3a02655465e00d8e885918f3959c /app/lib
parent2423830e3c08d319317dd193b7d3ad450016fd4a (diff)
Custom filters: add ability to create filters that exclude or are exclusive to roars with attachments.
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/feed_manager.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb
index 064903d71..bd418366c 100644
--- a/app/lib/feed_manager.rb
+++ b/app/lib/feed_manager.rb
@@ -206,6 +206,12 @@ class FeedManager
 
     active_filters.select! { |filter| filter.context.include?(context.to_s) && !filter.expired? }
 
+    if status.media_attachments.any?
+      active_filters.delete_if { |filter| filter.exclude_media }
+    else
+      active_filters.delete_if { |filter| filter.media_only }
+    end
+
     active_filters.map! do |filter|
       if filter.whole_word
         sb = filter.phrase =~ /\A[[:word:]]/ ? '\b' : ''