mbrevoort / jquery-facebook-multi-friend-selector

A jQuery based Alternative Facebook Multi-Friend Selector that uses the Graph API
Other
266 stars 64 forks source link

test user friends of test users don't show up #22

Closed yuvilio closed 12 years ago

yuvilio commented 12 years ago

When I'm logged in as a test user (say A) who has test user friends (say B and C), they don't show up in the selector. It looks like this is in the code that calls for friends:

$("#jfmfs-container").jfmfs({ friend_fields: "id,name,last_name", ...

this in turn makes a FB.api call like "https://graph.facebook.com/me/friends?fields=id,name,last_name&access_token=..." Usually this returns a data object with an array of objects [{ "id": "123456", "name": "Bob Smith", "last_name": "Smith" }, {..},] but for test users you get: [{ "id": "123456"}, {..},]

I am not sure why this is. Maybe Facebook does not allow names because they might somehow pollute the real user namespace? If this is not an error, maybe generating stub names might make sense for test users so that they can still be selected and the show can go on. That's what I'm thinking of doing. If I have a good patch, I'll pull request. Thoughts welcome,

yuvilio commented 12 years ago

I ended up adding those two fields to the response data:

FB.api('/me/friends?fields=' + settings.friend_fields, function(response) { /* if these are test users they won't have names, but we can just fill those in with stub data to get the friends to show up */ $.map( response.data, function(user){ if (! user.name) { user.name = "test testuser"; user.last_name = "testuser";
} return user; } );

yuvilio commented 12 years ago

Hmm, on second thought, this issue now seems fixed on facebook's end. The names are now showing up :)