You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
returned user doc doesn't always include _id field when from cache #9
I've had instances where the returned user doc doesn't include the _id field.
This can cause a bug in code like this:
// toggle the 'flag' of user given by 'username', or the logged in userconstuser=username
? Meteor.users.findOne({username},{fields: {[flag]: 1}})
: Meteor.user(flag);Meteor.users.update({id: user._id},{$set: {[flag]: !user[flag]}});
Which fails if username is falsey and the cached Meteor.user() doesn't contain the _id field.
Obviously this is a contrived example which could easily be rewritten, but I did hit this bug and so userCache should be fixed to return the expected result consistent with the default Meteor.user().
Activity
fix msavin#5 msavin#7 msavin#8 msavin#9