]> cat aescling's git repositories - mastodon.git/commitdiff
Filter out blocked/muted people from profile timelines (#7747)
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 6 Jun 2018 19:13:30 +0000 (21:13 +0200)
committerGitHub <noreply@github.com>
Wed, 6 Jun 2018 19:13:30 +0000 (21:13 +0200)
Fix #7741

app/models/status.rb

index 5189e173d6f9775b4e4c294075f2471965da7a32..7fa0690832a9517b17762f5ae17feb1671314edc 100644 (file)
@@ -305,7 +305,11 @@ class Status < ApplicationRecord
         # non-followers can see everything that isn't private/direct, but can see stuff they are mentioned in.
         visibility.push(:private) if account.following?(target_account)
 
-        where(visibility: visibility).or(where(id: account.mentions.select(:status_id)))
+        scope = left_outer_joins(:reblog)
+
+        scope.where(visibility: visibility)
+             .or(scope.where(id: account.mentions.select(:status_id)))
+             .merge(scope.where(reblog_of_id: nil).or(scope.where.not(reblogs_statuses: { account_id: account.excluded_from_timeline_account_ids })))
       end
     end