fixed bug in facebook service finder

This commit is contained in:
zhitomirskiyi 2011-01-25 13:49:42 -08:00
parent f3f38cf4fd
commit d976bf0966
2 changed files with 12 additions and 6 deletions

View file

@ -20,9 +20,10 @@ class Services::Facebook < Service
response = RestClient.get("https://graph.facebook.com/me/friends", {:params => {:access_token => self.access_token}})
data = JSON.parse(response.body)['data']
data_h = Hash[*data.collect {|v|
[v['id'], {:name => v['name']}]
}.flatten]
data_h = {}
data.map do |d|
data_h[d['id']] = {:name => d['name']}
end
service_objects = Services::Facebook.where(:uid => data_h.keys).includes(:user => :person)
service_objects.each{|s| data_h[s.uid][:person] = s.user.person}

View file

@ -16,7 +16,12 @@
%h4.name
= link_to friend[:name], '#'
- if friend[:person]
.right
= aspect_membership_button(aspect, contact, contact.person)
- if person = friend[:person]
.right
= link_to t('people.show.start_sharing'),
{:controller => "people",
:action => "share_with",
:id => person.id},
:class => 'button',
:rel => 'facebox'