I can show my own profile image after it is uploaded. However, when I log in as a another user, I can see the profile image on user's profile page but not within a row of chats. There are a few items to note:
- once a room is started, theres 2 people in it, owner and receiver. So usually u want to show the image of the other guy other than yourself.
- images are saved for now with Cloudinary under profile --> profilepicId as an Id which Cloudinary references to and then generates an image.
Additionally, server throws error below. As a result, sometimes, I cannot see the items from that user when I go to his page.
> Exception from sub user id JS9gKeT4sXNDCwip6 Error: Match error: > Expected string, got undefined I20170410-23:28:59.972(8)? at > exports.check (packages/check/match.js:34:1) > I20170410-23:28:59.972(8)? at Subscription.<anonymous> > (server/server.js:88:2) I20170410-23:28:59.973(8)? at > Subscription.prepareOptions > (packages/reywood_publish-composite/packages/reywood_publish-composite.js:440:1) > I20170410-23:28:59.973(8)? at Subscription._handler > (packages/reywood_publish-composite/packages/reywood_publish-composite.js:408:1) > I20170410-23:28:59.973(8)? at packages/check/match.js:107:1 > I20170410-23:28:59.973(8)? at [object Object]._.extend.withValue > (packages/meteor/dynamics_nodejs.js:56:1) I20170410-23:28:59.973(8)? > at Object.exports.Match._failIfArgumentsAreNotAllChecked > (packages/check/match.js:106:1) I20170410-23:28:59.974(8)? at > maybeAuditArgumentChecks > (packages/ddp-server/livedata_server.js:1701:18) > I20170410-23:28:59.974(8)? at Subscription._runHandler > (packages/ddp-server/livedata_server.js:1026:17) > I20170410-23:28:59.974(8)? at Session._startSubscription > (packages/ddp-server/livedata_server.js:845:9) > I20170410-23:28:59.974(8)? Sanitized and reported to the client as: > Match failed [400]
user publish
Meteor.publish('userDetails', function() {
var fields = { username: 1, emails : 1, profile : 1, md5hash : 1 };
return Meteor.users.find( {}, { fields: fields });
});
Meteor.publishComposite('user', function (_id) {
check(_id, String); //this check throws the error yet I cannot remove it
//if (!_id) return this.ready(); doesnt help remove error
return {
find: function() {
return Meteor.users.find({ _id: _id }, {
fields: { username: 1, emails: 1, profile : 1, md5hash: 1}
});
},
children: [
{
find: function(user) {
return Posts.find({ userId: user._id });
}
}
]
};
});
allrooms.js
Template.allRooms.onCreated(function(){
var self = this;
self.autorun(function(){
self.subscribe('rooms');
self.subscribe('user');
});
});
Template.allRooms.helpers({
rooms: function () {
return Rooms.find();
}
});
allrooms.html
<!-- #with user/s, chatPerson, rooms doesnt work -->
<img src="">
<div class="avatar" style="background: url(); height: 60px; width: 60px; float:left;"></div>
<div class="item-inner"> in roomId: </div>
roomCollection.js
Rooms.helpers({
chatPersonId: function(){
if( this.owner === Meteor.userId() ) {
return Meteor.users.findOne({ _id: this.receiver })._id;
} else {
return Meteor.users.findOne({ _id: this.owner })._id;
}
},
chatPerson: function(){
if( this.owner === Meteor.userId() ) {
return Meteor.users.findOne({ _id: this.receiver }).username;
} else {
return Meteor.users.findOne({ _id: this.owner }).username;
}
}
});
via Thinkerer
No comments:
Post a Comment