Commit d976bf09 authored by zhitomirskiyi's avatar zhitomirskiyi

fixed bug in facebook service finder

parent f3f38cf4
......@@ -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}
......
......@@ -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'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment