criso / fbgraph

NodeJs module to access the facebook graph api
http://criso.github.io/fbgraph/
1.09k stars 176 forks source link

Wall post with privacy settings don't work #9

Closed josser closed 12 years ago

josser commented 12 years ago

Hi, here the example:

fbgraph.setAccessToken(object._user.auth.facebook.access_token);

fbgraph.post( "/me/feed", { message: 'Someone commented your post: ' + object.comments[0].message, privacy: { value: 'CUSTOM', friends: 'SELF' } }, function(err, res){ if (err) { console.log(err); } });

I see message on the wall but privacy settings doesn't applied.

I made some investigation and found that problem is in querystring:

Graph.prototype.post = function() { var self = this , postData = querystring.stringify(this.postData); // Querystring don't like nested objects. this.options.body = postData;

Here REPL session example:

t = {message: "123", smth: { subprop: "123"}}; { message: '123', smth: { subprop: '123' } } qs = require("querystring"); { unescapeBuffer: [Function], unescape: [Function], escape: [Function], encode: [Function], stringify: [Function], decode: [Function], parse: [Function] } qs.stringify(t) 'message=123&smth='

Here the issue (I'm curious why it closed): https://github.com/joyent/node/issues/1665

josser commented 12 years ago

Oh, cool, cool! Can you please publish this new version to npm? :) Thanks!

criso commented 12 years ago

All set!