about summary refs log tree commit diff
path: root/spec/lib
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-06-25 14:45:14 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-06-25 14:45:14 +0200
commit47ef4a6c7a74072daff8b23c4af3e300bb75ba1a (patch)
treeafa97381a3bc8bd5e5c910d873dddc3fa3b2ff4e /spec/lib
parent66ac1bd063882f5a2f828c1c702089e37f36f217 (diff)
Apply filters to poll options (#11174)
* Apply filters to poll options in WebUI

Fixes #11128

* Apply filters to poll options server-side

* Add poll options to searchable text
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/feed_manager_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb
index 5f8eb86a8..9bdb675e1 100644
--- a/spec/lib/feed_manager_spec.rb
+++ b/spec/lib/feed_manager_spec.rb
@@ -149,6 +149,14 @@ RSpec.describe FeedManager do
           status = Fabricate(:status, text: 'shiitake', account: jeff)
           expect(FeedManager.instance.filter?(:home, status, alice.id)).to be true
         end
+
+        it 'returns true if phrase is contained in a poll option' do
+          alice.custom_filters.create!(phrase: 'farts', context: %w(home public), irreversible: true)
+          alice.custom_filters.create!(phrase: 'pop tarts', context: %w(home), irreversible: true)
+          alice.follow!(jeff)
+          status = Fabricate(:status, text: 'what do you prefer', poll: Fabricate(:poll, options: %w(farts POP TARts)), account: jeff)
+          expect(FeedManager.instance.filter?(:home, status, alice.id)).to be true
+        end
       end
     end