Skip to content

Commit 06ae516

Browse files
committed
finally solved a problem where the followers/followings actions would save userId as null in the friendships collection
1 parent c647c12 commit 06ae516

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Jaunt/client/lib/routes.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Router.map(function(){
1313
var post = Posts.listGlobal();;
1414
var timelineTitle = "Posts";
1515
var noPostsMessage = "There are no Posts";
16-
console.log('QTD followers');
17-
console.log(Friendships.followers(_id));
1816
if (Session.get("timelineToDisplay") === "timelineGlobal"){
1917
//the line below is used to format the date time.
2018
posts = Posts.listGlobal().map(function (value) {value.date = formatDate(value.date); return value;});

Jaunt/models/friendships.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Friendships = new Meteor.Collection("friendships");
44
* creates a new relation between two users.
55
*/
66
Friendships.follow = function(friendId){
7-
this.insert({userId : this.userId,
7+
this.insert({userId : Meteor.user()._id,
88
friendId : friendId
99
});
1010
};
@@ -14,7 +14,7 @@ Friendships.follow = function(friendId){
1414
*/
1515
Friendships.unfollow = function(friendId){
1616
this.remove({
17-
userId : this.userId,
17+
userId : Meteor.user()._id,
1818
friendId : friendId
1919
});
2020
};
@@ -24,7 +24,7 @@ Friendships.unfollow = function(friendId){
2424
returns the relationship if it exists or undefined otherwise.
2525
*/
2626
Friendships.isFollowing = function(friendId){
27-
return this.findOne({userId : this.userId,
27+
return this.findOne({userId : Meteor.user()._id,
2828
friendId : friendId});
2929
};
3030

0 commit comments

Comments
 (0)