diff --git a/app/models/post.rb b/app/models/post.rb index 1905854fa..211972931 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -52,9 +52,10 @@ class Post < ApplicationRecord scope :all_public, -> { where(public: true) } scope :all_local_public, -> { - left_outer_joins(author: [:pod]) - .where("pods.host is null") # local posts have no host in pods - .where(public: true) + where(" exists ( + select 1 from people where posts.author_id = people.id + and people.pod_id is null) + and posts.public = true") } scope :commented_by, ->(person) {