the friend finder is respecting of searchable

This commit is contained in:
zhitomirskiyi 2011-01-28 13:45:58 -08:00
parent ca76572eae
commit 3b68fc3e9a
2 changed files with 7 additions and 1 deletions

View file

@ -39,7 +39,7 @@ class Services::Facebook < Service
service_objects = Services::Facebook.where(:uid => data_h.keys).includes(:user => {:person => :profile})
service_objects.each do |s|
data_h[s.uid][:person] = s.user.person
data_h[s.uid][:person] = s.user.person if s.user.person.profile.searchable
data_h[s.uid][:contact] = self.user.contacts.where(:person_id => s.user.person.id).first
end

View file

@ -70,6 +70,12 @@ JSON
it 'contains a diaspora person object' do
@service.finder.values.first[:person].should == @user2.person
end
it 'does not include the person if the search is disabled' do
p = @user2.person.profile
p.searchable = false
p.save
@service.finder.values.first[:person].should be_nil
end
it 'contains a contact object if connected' do
connect_users(@user, @user.aspects.first, @user2, @user2.aspects.first)
@service.finder.values.first[:contact].should == @user.reload.contact_for(@user2.person)