Skip to content

Commit

Permalink
Step 14.1: Add uninvited users publication
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored and DAB0mB committed Dec 14, 2016
1 parent a2455dc commit 0107f13
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions server/imports/publications/users.ts
@@ -0,0 +1,18 @@
import { Meteor } from 'meteor/meteor';

import { Parties } from '../../../both/collections/parties.collection';

Meteor.publish('uninvited', function (partyId: string) {
const party = Parties.findOne(partyId);

if (!party) {
throw new Meteor.Error('404', 'No such party!');
}

return Meteor.users.find({
_id: {
$nin: party.invited || [],
$ne: this.userId
}
});
});

0 comments on commit 0107f13

Please sign in to comment.