about summary refs log tree commit diff
path: root/spec/lib/feed_manager_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/feed_manager_spec.rb')
-rw-r--r--spec/lib/feed_manager_spec.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb
index 3f91bba4e..db9bf12d1 100644
--- a/spec/lib/feed_manager_spec.rb
+++ b/spec/lib/feed_manager_spec.rb
@@ -175,7 +175,7 @@ RSpec.describe FeedManager do
       it 'returns true for a status with a tag that matches a muted keyword' do
         Fabricate('Glitch::KeywordMute', account: alice, keyword: 'jorts')
         status = Fabricate(:status, account: bob)
-	status.tags << Fabricate(:tag, name: 'jorts')
+        status.tags << Fabricate(:tag, name: 'jorts')
 
         expect(FeedManager.instance.filter?(:home, status, alice.id)).to be true
       end
@@ -183,10 +183,18 @@ RSpec.describe FeedManager do
       it 'returns true for a status with a tag that matches an octothorpe-prefixed muted keyword' do
         Fabricate('Glitch::KeywordMute', account: alice, keyword: '#jorts')
         status = Fabricate(:status, account: bob)
-	status.tags << Fabricate(:tag, name: 'jorts')
+        status.tags << Fabricate(:tag, name: 'jorts')
 
         expect(FeedManager.instance.filter?(:home, status, alice.id)).to be true
       end
+
+      it 'returns false if the status is muted by a keyword mute that does not apply to mentions' do
+        Fabricate('Glitch::KeywordMute', account: alice, keyword: 'take', apply_to_mentions: false)
+        status = Fabricate(:status, spoiler_text: 'This is a hot take', account: bob)
+        status.mentions.create!(account_id: alice.id)
+
+        expect(FeedManager.instance.filter?(:home, status, alice.id)).to be false
+      end
     end
 
     context 'for mentions feed' do
@@ -222,6 +230,13 @@ RSpec.describe FeedManager do
         bob.follow!(alice)
         expect(FeedManager.instance.filter?(:mentions, status, bob.id)).to be true
       end
+
+      it 'returns false for a mention that contains a word muted by a keyword that does not apply to mentions' do
+        Fabricate('Glitch::KeywordMute', account: bob, keyword: 'take', apply_to_mentions: false)
+        status = Fabricate(:status, text: 'This is a hot take', account: alice)
+        bob.follow!(alice)
+        expect(FeedManager.instance.filter?(:mentions, status, bob.id)).to be false
+      end
     end
   end