meteor - Am I approaching making a "friend" collection the correct way? -


I want to be able to become a friend with my friend in my application to become a friend. A friend request is sent, and then there is an option to accept or not to the other person. I want to have two separate lists, the first list is the friend of the user, and the other people who send him or her to the requests are currently I have a friend collection:

Friend = New Meteor. Collection ("friends");

The way I am making friends:

  Template.friend.events ({'click #addFriend': function (e, t) { Var email = $ ("#friendmail") Val (); var friend = metier.user.find ({"email.address": email}); if (friend) {return friend.Incent ({friend 1: meteor . (), Friend 2: friend._ id, name: email, state: 'pending'});}}});  

Now I have a problem, I have a template at this time to retrieve friends:

  Template.friend.friends = Function () {return friends Find ({Friends1: Meteorite ()}); }  

And then I have my html in:

  {{# every friend}} 

Presenting friends.

But here's the problem: How can I ensure that friends can accept any request, and how do I do it, I can make two different columns? More important than this, I think that this is a wrong way of working, should I get it in this way too?

Edit:

I have got rid of the buddy and collected a notification after the Phoenix protocol Made, and I have created the following to test and see that this will work:

  Template.friends.sent = function ({{Notification.find} {Meteor.user (), Type: "friendship"}); }  

with the following HTML:

  {# each sent} & lt; P & gt; {{To.emails.0.address}} & lt; / P & gt;  

but gives an error by saying:

  Expected IDENTIFIER  

Keep two collections:

Meteor.users and notifications

When a friend request is sent, you can register it on notifications , type: friendship , status: pending , Do: User1 and to: user2 . Then, in the user profile, you can query for pending notifications that the user 2 whom they are from whom if user2 accepts you register it for user1 on the collection < Code> Meteor.users After processing the request, either are accepted or not, you can delete the notification.

In fact, I can also take status from the property to notifications from the property, in this way you can delete them anyway. / P>

Are you using bootstrap or plain CSS about two column templates?

with Bootstrap (3 in this case):

  & lt; Div class = "row" & gt; & Lt; Div class = "col-xs-6" & gt; {{ColumnOne}} & lt; / Div & gt; & Lt; Div class = "col-xs-6" & gt; {{ColumnTwo}} & lt; / Div & gt; & Lt; / Div & gt;  

with plain CSS

  .row {width: 100%; } .column {width: 50%}  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -