diff --git a/server/imports/publications/parties.ts b/server/imports/publications/parties.ts index 08ef863ef..b7652bbb9 100644 --- a/server/imports/publications/parties.ts +++ b/server/imports/publications/parties.ts @@ -1,4 +1,24 @@ import { Meteor } from 'meteor/meteor'; import { Parties } from '../../../both/collections/parties.collection'; -Meteor.publish('parties', () => Parties.find()); +Meteor.publish('parties', function() { + const selector = { + $or: [{ + // party is public + public: true + }, + // or + { + // current user is the owner + $and: [{ + owner: this.userId + }, { + owner: { + $exists: true + } + }] + }] + }; + + return Parties.find(selector); +});