]> cat aescling's git repositories - mastodon.git/commitdiff
Filter out reblogs of blocked users from public timeline (the not real-time variant)
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 16 Oct 2016 16:35:20 +0000 (18:35 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 16 Oct 2016 16:35:20 +0000 (18:35 +0200)
app/models/status.rb

index 111172e9abcc1d19572bd514dce5f8ab50750f64..3f150c5dea5b1495a587ff71aa481bd27a33ee27 100644 (file)
@@ -86,7 +86,7 @@ class Status < ApplicationRecord
   end
 
   def self.as_public_timeline(account)
-    where.not(account_id: account.blocking).with_includes.with_counters
+    joins('LEFT JOIN statuses AS reblogs ON reblogs.id = statuses.reblog_of_id').where('reblogs.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?) AND statuses.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?)', account.id, account.id).with_includes.with_counters
   end
 
   def self.favourites_map(status_ids, account_id)