How to create something like friendship requests, similar to Facebook

Say we have a social media app were users login and make posts. The user data is published so we can see individual user profiles. How do we go about making a system that adds users as friends, like in facebook; or followers , like Twitter?

Three approaches so far.

First approach was to find an online tutorial of someone creating a social media app, like Facebook or Twitter. All the ones I came across were using older versions of Meteor before 1.2. Or were sing autopublish and insecure. I like to start my mornings doing a Meteor tutorial or video, but it looks like I am running out of advanced ones.

Tried looking on atmosphere for packages, but couldnt find one with a tutorial explaining how to use it.

Plan C being make my own package from scratch. In my mind the hardest part is making buttons, but I guess they can be text buttons and later get a designer to make better ones.

So lets say the collection is called friendRequests. We need to take the id of user that is being sent a request, id of user sending, and its status. Status being pending or accepted.

UserB pushes a request button on userA page. A document is created looking something like this.
requestTo: userAID
requestFrom: userBID
status: p

If accepted the status is changed to A. If denied the document is just deleted.

Is this how other people do it?

I havent started coding. Just planning things out.

I’d store friends/followers data in a separate collection, but is there a reason to do this for friend requests?

in the way i mapped out, the friendsRequests become the collection for followers.

Everything you need is available using https://atmospherejs.com/socialize/friendships and almost any other social feature is available as a package under the same organization https://atmospherejs.com/socialize/

If you have issues, let me know and I’ll see about helping you get started.

1 Like

i watched your video before and didnt get it working.

thinking of making an array to collect id of connections.

ok so ended with a collection of userConnections.click event.

sample of my help during an

var userConnectFrom= Meteor.userId();
var userConnectTo = this._id;

my call to the server it inset it into the collection works. but so far userConnectTo is blank. the result in my database is no field. just UserConnectFrom is there.

so far quick and dirty. a collection storing two usernames. got as far as displaying all connections and blocking the connect button if connection already made. next is to try remove from to disconnect.

mission completed. adds connections, displays on profile and disconnects.easy and dirty which can be improved later.
if someone wants to login and tell us what they think.
http://www.subpattern.com/