changeset 11:9d17cb5147ca

back to fql, added fb user_friends permission
author Mathias Gebbe <mgebbe@intevation.de>
date Thu, 12 Jun 2014 01:08:00 +0200
parents ccf1d9e741bd
children f190abf340ef
files src/facebook.coffee views/index.jade
diffstat 2 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/facebook.coffee	Wed Jun 11 23:43:28 2014 +0200
+++ b/src/facebook.coffee	Thu Jun 12 01:08:00 2014 +0200
@@ -197,25 +197,27 @@
 ##############################################
 getFriends = (user) ->
   me = user.user_pumpio
+  id = user.user_ESN.substr(0,user.user_ESN.indexOf('@'))
   token = user.oauth_token
 
   EdgeControl.removeEdges(me,'@facebook')
   EdgeControl.removeEdges(me,'www.facebook.com')
 
   FB.setAccessToken token
-
-  FB.api "me/friends?limit=500",
-    fields: [
-      "id"
-    ]
+  FB.api "fql",
+    q: "SELECT uid2 FROM friend WHERE uid1 = me()"
   , (res) ->
+    console.log res
     if not res or res.error
       console.log (if not res then "error occurred" else res.error)
+      return
 
-    _.each res.data, (page) ->
-      getUserById(me,page.id,token) if user.id?
+    _.each res.data, (user) ->
+      getUserById(me,user.uid2,token) 
       return
 
+    return
+
   return
 
 
@@ -237,7 +239,7 @@
       console.log (if not res then "error occurred" else res.error)
 
     _.each res.data, (page) ->
-      getUserById(me,page.id,token) if user.id?
+      getUserById(me,page.id,token)
       return
 
   return
--- a/views/index.jade	Wed Jun 11 23:43:28 2014 +0200
+++ b/views/index.jade	Thu Jun 12 01:08:00 2014 +0200
@@ -149,7 +149,7 @@
                //Not logged in
                //alert('you cancelled login or did not fully authorize.');
              }
-           }, {scope: 'publish_actions,publish_stream,read_stream,read_friendlists,user_likes,read_insights,user_activities'});
+           }, {scope: 'publish_actions,publish_stream,read_stream,read_friendlists,user_friends,user_likes,user_activities'});
          })
 
         //$('.logoutbutton').on('click', function(e){
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)