diff --git a/lib/diaspora/user/querying.rb b/lib/diaspora/user/querying.rb index 848e8b0e26f0b38e2fece592a0023fba8926091e..23d560cc47c8572370248eb5f9d018e6ca827075 100644 --- a/lib/diaspora/user/querying.rb +++ b/lib/diaspora/user/querying.rb @@ -7,7 +7,8 @@ module Diaspora module Querying def find_visible_post_by_id( id ) - self.raw_visible_posts.where(:id => id).includes({:author => :profile}, {:comments => {:author => :profile}}, :photos).first + post = Post.where(:id => id).joins(:contacts).where(:contacts => {:user_id => self.id}).first + post ||= Post.where(:id => id, :author_id => self.person.id).first end def raw_visible_posts(opts = {})