forked from cybrespace/mastodon
		
	exclude-other-silenced-accounts (#7528)
This commit is contained in:
		
							parent
							
								
									2374a00c10
								
							
						
					
					
						commit
						4bdab203ac
					
				
					 2 changed files with 2 additions and 12 deletions
				
			
		| 
						 | 
					@ -384,7 +384,8 @@ class Status < ApplicationRecord
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def account_silencing_filter(account)
 | 
					    def account_silencing_filter(account)
 | 
				
			||||||
      if account.silenced?
 | 
					      if account.silenced?
 | 
				
			||||||
        including_silenced_accounts
 | 
					        including_myself = left_outer_joins(:account).where(account_id: account.id).references(:accounts)
 | 
				
			||||||
 | 
					        excluding_silenced_accounts.or(including_myself)
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        excluding_silenced_accounts
 | 
					        excluding_silenced_accounts
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -573,17 +573,6 @@ RSpec.describe Status, type: :model do
 | 
				
			||||||
          expect(results).to include(es_status)
 | 
					          expect(results).to include(es_status)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					 | 
				
			||||||
      context 'where that account is silenced' do
 | 
					 | 
				
			||||||
        it 'includes statuses from other accounts that are silenced' do
 | 
					 | 
				
			||||||
          @account.update(silenced: true)
 | 
					 | 
				
			||||||
          other_silenced_account = Fabricate(:account, silenced: true)
 | 
					 | 
				
			||||||
          other_status = Fabricate(:status, account: other_silenced_account)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          results = Status.as_public_timeline(@account)
 | 
					 | 
				
			||||||
          expect(results).to include(other_status)
 | 
					 | 
				
			||||||
        end
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue