Skip to content
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

Working example of friends list on the user #2

Closed
wants to merge 5 commits into from
Closed

Working example of friends list on the user #2

wants to merge 5 commits into from

Conversation

schickm
Copy link

@schickm schickm commented Mar 31, 2015

So, after much mucking around I figured out how to do it.

What needed to happen is that you needed to add the friendslist to the user when the account get's created. To do so you have to take advantage of Accounts.onCreateUser:

http://docs.meteor.com/#/full/accounts_oncreateuser

That is a hook that get's run on the server. You might think the solution would be to add it to the profile, but one gotcha is that only changes made to the top level of an object are sent over the wire from the server to the client. So if you change something in the user's profile on the server, that change won't get sent back to the client.

So I ended up adding a 'friendslist' property directly onto the user. This required me also to create an allow method so it can be updated, and also create a publication/subscription of that same property.

I've annotated the commits with comments as well

@schickm schickm closed this Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant