diff --git a/lib/diaspora/user/querying.rb b/lib/diaspora/user/querying.rb index baeb0118b..788dfb9a5 100644 --- a/lib/diaspora/user/querying.rb +++ b/lib/diaspora/user/querying.rb @@ -64,7 +64,7 @@ module Diaspora end def construct_shareable_from_others_query(opts) - conditions = {:pending => false, :share_visibilities => {:hidden => opts[:hidden]}, :contacts => {:user_id => self.id} } + conditions = {:pending => false, :share_visibilities => {:hidden => opts[:hidden]}, :contacts => {:user_id => self.id, :receiving => true} } conditions[:type] = opts[:type] if opts.has_key?(:type) query = opts[:klass].joins(:contacts).where(conditions) diff --git a/spec/models/user/querying_spec.rb b/spec/models/user/querying_spec.rb index a304289c9..2101d662e 100644 --- a/spec/models/user/querying_spec.rb +++ b/spec/models/user/querying_spec.rb @@ -34,9 +34,10 @@ describe User do alice.visible_shareable_ids(Post).should include(eves_public_post.id) end - it "contains non-public posts from people who are following you" do - bobs_post = bob.post(:status_message, :text => "hello", :to => @bobs_aspect.id) - alice.visible_shareable_ids(Post).should include(bobs_post.id) + it "does not contain non-public posts from people who are following you" do + eve.share_with(alice.person, @eves_aspect) + eves_post = eve.post(:status_message, :text => "hello", :to => @eves_aspect.id) + alice.visible_shareable_ids(Post).should_not include(eves_post.id) end it "does not contain non-public posts from aspects you're not in" do