Friday, June 20, 2014

Friend Request in JavaScript using - Part 3

Now for actions, assuming you added some nice little buttons to those lists.

These are very simplistic, just to show the concept. You would probably want to have some Cloud Code that will verify things in a before-save function. Also all my examples haven't included any error handling but you should add some.

Approve a request

// assuming you saved the as maybe an attribute
// data-friend-request-id="xxxx" on the Approve button this code is
// linked to
var friendRequest = new FriendRequest(); = $(this).data('friendRequestId');
friendRequest.set('status', RequestStatus.approved);;

Reject a request

As per Approve, but use
friendRequest.set('status', RequestStatus.rejected);


As per Approve, but use
friendRequest.set('status', RequestStatus.rejected);

1 comment:

Bryan said...

Hello Timothy. I came across your profile on and this blog post while searching for some insight into our scaling issues. I am one of the founders of an app built on top of Parse. We are experiencing extremely fast growth: over 40k user with actions exceeding 17 million. I'm sure we would benefit greatly from some advice on our architecture. Please let me know if you might have some time for a quick call to see if you might be able to help. It would be much appreciated!