]> cat aescling's git repositories - mastodon.git/commitdiff
exclude-other-silenced-accounts (#7528)
authormasarakki <masaki182@gmail.com>
Wed, 22 Aug 2018 11:20:50 +0000 (20:20 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 22 Aug 2018 11:20:50 +0000 (13:20 +0200)
app/models/status.rb
spec/models/status_spec.rb

index 6ba7b7a509eee2c51100efdd294d4da09097f689..35655bff2377d87f72d2dc8844fbe4851b612292 100644 (file)
@@ -384,7 +384,8 @@ class Status < ApplicationRecord
 
     def account_silencing_filter(account)
       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
         excluding_silenced_accounts
       end
index d03005107e0f116bc5241e364a4148fef22cfcc6..9d8670129d40ebc90018c0fdfff352bfa086d86e 100644 (file)
@@ -573,17 +573,6 @@ RSpec.describe Status, type: :model do
           expect(results).to include(es_status)
         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