Fix filtering for lists (#33842)
This commit is contained in:
		
							parent
							
								
									452153d55d
								
							
						
					
					
						commit
						679e7555ee
					
				@ -42,7 +42,7 @@ class FeedManager
 | 
				
			|||||||
    when :home
 | 
					    when :home
 | 
				
			||||||
      filter_from_home(status, receiver.id, build_crutches(receiver.id, [status]), :home)
 | 
					      filter_from_home(status, receiver.id, build_crutches(receiver.id, [status]), :home)
 | 
				
			||||||
    when :list
 | 
					    when :list
 | 
				
			||||||
      (filter_from_list?(status, receiver) ? :filter : nil) || filter_from_home(status, receiver.account_id, build_crutches(receiver.account_id, [status], list: list), :list)
 | 
					      (filter_from_list?(status, receiver) ? :filter : nil) || filter_from_home(status, receiver.account_id, build_crutches(receiver.account_id, [status], list: receiver), :list)
 | 
				
			||||||
    when :mentions
 | 
					    when :mentions
 | 
				
			||||||
      filter_from_mentions?(status, receiver.id) ? :filter : nil
 | 
					      filter_from_mentions?(status, receiver.id) ? :filter : nil
 | 
				
			||||||
    when :tags
 | 
					    when :tags
 | 
				
			||||||
 | 
				
			|||||||
@ -194,6 +194,28 @@ RSpec.describe FeedManager do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    context 'with list feed' do
 | 
				
			||||||
 | 
					      let(:list) { Fabricate(:list, account: bob) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      before do
 | 
				
			||||||
 | 
					        bob.follow!(alice)
 | 
				
			||||||
 | 
					        list.list_accounts.create!(account: alice)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      it "returns false for followee's status" do
 | 
				
			||||||
 | 
					        status = Fabricate(:status, text: 'Hello world', account: alice)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        expect(described_class.instance.filter?(:list, status, list)).to be false
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      it 'returns false for reblog by followee' do
 | 
				
			||||||
 | 
					        status = Fabricate(:status, text: 'Hello world', account: jeff)
 | 
				
			||||||
 | 
					        reblog = Fabricate(:status, reblog: status, account: alice)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        expect(described_class.instance.filter?(:list, reblog, list)).to be false
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context 'with mentions feed' do
 | 
					    context 'with mentions feed' do
 | 
				
			||||||
      it 'returns true for status that mentions blocked account' do
 | 
					      it 'returns true for status that mentions blocked account' do
 | 
				
			||||||
        bob.block!(jeff)
 | 
					        bob.block!(jeff)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user