fix construct_shareable_from_others_query to only include posts from contacts within your aspects
This commit is contained in:
parent
1d0109d4cb
commit
fd76cfd4c5
2 changed files with 5 additions and 4 deletions
|
|
@ -64,7 +64,7 @@ module Diaspora
|
||||||
end
|
end
|
||||||
|
|
||||||
def construct_shareable_from_others_query(opts)
|
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)
|
conditions[:type] = opts[:type] if opts.has_key?(:type)
|
||||||
query = opts[:klass].joins(:contacts).where(conditions)
|
query = opts[:klass].joins(:contacts).where(conditions)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,10 @@ describe User do
|
||||||
alice.visible_shareable_ids(Post).should include(eves_public_post.id)
|
alice.visible_shareable_ids(Post).should include(eves_public_post.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "contains non-public posts from people who are following you" do
|
it "does not contain non-public posts from people who are following you" do
|
||||||
bobs_post = bob.post(:status_message, :text => "hello", :to => @bobs_aspect.id)
|
eve.share_with(alice.person, @eves_aspect)
|
||||||
alice.visible_shareable_ids(Post).should include(bobs_post.id)
|
eves_post = eve.post(:status_message, :text => "hello", :to => @eves_aspect.id)
|
||||||
|
alice.visible_shareable_ids(Post).should_not include(eves_post.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not contain non-public posts from aspects you're not in" do
|
it "does not contain non-public posts from aspects you're not in" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue