-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Levy iss01 #2
base: master
Are you sure you want to change the base?
Levy iss01 #2
Conversation
Your fix would solve the problem, but it then presents the problem that you point out in issue #3. I'd like you to take another shot at this one. The changes you commit to the branch will be picked up by the pull request automatically, so you don't need to do anything beyond committing the new code and pushing to your remote branch. Here are a few hints:
|
DescriptionI found what I believe is a fix to the bug that results in incorrect or missing user profile information. Using console.log() statements I found that the "userId" and "user" values in the userName object were undefined upon being called. I noticed this yesterday too but was unsure of myself at the time. By updating Meteor.users.findOne(userId) to Meteor.users.findOne(Meteor.userId), the userName object seems able to locate the profile information for the user correctly. If this is indeed the correct fix, then I think that dashboard.html should be updated to make use of the userName object as well, otherwise it will still result in missing profile information when an optional profile name is not given. (e.g. {{userName}} instead of {{currentUser.profile.name}}). Further ConcernsWhile this seems to fix the problem, I am a bit unsure of myself as I see other bugs and am not sure if they are related. When a user logs out and logs back in under a different name, the profile information is not updated properly without a manual refresh of the page. A brief search on stackoverflow indicates that this may be due to Meteor.user().profile not being available until a moment after Meteor.user() becoming available. http://stackoverflow.com/questions/14847575/meteor-user-profile-can-only-read-after-refresh |
Right, so Meteor.user() and Meteor.userId() are reactive data sources, and depend on the currently logged in user. Meteor.userId() typically would return a value pretty quick, but may not be defined right away. Meteor.user() is a helper for that essentially returns the equivalent of Meteor.users.findOne(Meteor.userId()), so it has to grab the data from the database. The I don't think we would want to make a change in the I also agree with your change from {{currentUser.profile.name}} to {{userName}}, so feel free to make that change. |
Detailed description of bug and possible cause:
Further observations:
Proposed fix:
Testing:
|
Well done! I might also suggest that you could alter the
Then, you only need to pass in a userId when you are getting other user names. Default behavior would be to return the current user's name. |
Summary:
This branch contains a bug fix for issue-1, missing username in home view. The home view always indicated "unknown user" regardless of who was logged in.
Fix:
Lines 39 and 40 of /packages/login/client/templates.html incorrectly referenced the username. The following substitution was made: {{userName}} was altered to read {{currentUser.profile.name}}