I'm currently working on an application, wherein which I've build out chat functionality.
I currently have a very limited way to create conversations, during which the user creating it, and the designated target user both have their ID's put into a Conversation document within a Conversations collection.
Im currently trying to loop through the array containing each of these ID's, and upon finding the ID that doesn't match the current users, to grab the other users profile information.
otherUserName: function(){
for ( i = 0; i < this.users.length; i++ ) {
if( this.users[i].id !== Meteor.user()._id){
return( Meteor.users.findOne({ _id: this.users[i].id }));
}
}
}
Currently however, it doesn't output anything. It only shows up as undefined.
Any clue what I need to do to get the name to show up?