I've adapted server.js from the Parties example.
Instead of having "directory" publish all the users I want it to publish only those users that:
- own a party the current user is invited to
- are invited to a party the current user is invited to
- are invited to a party the current user owns
See here: https://github.com/dimfisch/meteor-dependency/blob/master/parties/server/server.js
The problem is that when the current user invites a new user (new in the sense that they haven't been party-related previously) or gets invited by a new user, the "directory" subscription doesn't update, since the reactivity is on the cursor returned, which doesn't change in these cases.
Here are the steps to reproduce this situation:
- open two different clients, say Joe and Kate
- Joe creates a new private party and invites Kate
- Kate sees that new party, but doesn't get any info about Joe in Meteor.users
- I want Joe to show up in Kate's client
So the question is, how can that be achieved? One potential route is to make the "parties" cursor observeChanges, in the "directory" publish function. But I'm not sure this would actually work and I'm wondering if there's a more straightforward solution.