Meteor-Community-Packages / meteor-partitioner

Transparently divide a single meteor app into several different instances shared between different groups of users.
152 stars 18 forks source link

Check user has been logged in before taking action for hooking #35

Closed hieuwu closed 4 years ago

hieuwu commented 4 years ago

I applied Partitioner for a quite big project and I got a problem. Because I have many collections, which can lead to a status that Partitioner can not find the User Id fast enough to perform some actions in the findHook function. Then ever time I run my project, it throws this exception, userIdErr: "Must be logged in to operate on partitioned collection". And after adding this if statement, problem solved

mizzao commented 4 years ago

Thanks for your PR! I don't have time to maintain this project anymore, so I gave you commit access to make any changes you'd like. It would be nice to follow the style used by the rest of the code and add some tests to this patch, if possible.

I also noticed you have a 4-tab spacing in your editor, which will probably confuse Coffeescript. I suggest configuring it as 2 tabs instead (note that the diff on the PR is quite big).

If you'd like to directly publish new versions of the package, just send me your Meteor username and I'll add you as a maintainer as well.

hieuwu commented 4 years ago

@mizzao I am quite confused about the "Meteor username". What do you mean? And I will make some changes in my code style. About the test I think it is not necessary because it's about the delay of the runtime. If we have many collections, it takes time to get the user ID so I just add this statement to make sure the hook only run when already have the user ID