Permalink
Browse files

Step 13.30: Add user publication

  • Loading branch information...
dotansimha authored and darkbasic committed Jan 24, 2017
1 parent 11dee0c commit 029b7d6a7b0e54629628ddb5d9421e48008ecc62
Showing with 13 additions and 0 deletions.
  1. +13 −0 api/server/publications.ts
@@ -2,6 +2,7 @@ import { User, Message, Chat } from './models';
import { Users } from './collections/users';
import { Messages } from './collections/messages';
import { Chats } from './collections/chats';
import { Pictures } from './collections/pictures';
Meteor.publishComposite('users', function(
pattern: string
@@ -74,3 +75,15 @@ Meteor.publishComposite('chats', function(): PublishCompositeConfig<Chat> {
]
};
});
Meteor.publish('user', function () {
if (!this.userId) {
return;
}
const profile = Users.findOne(this.userId).profile || {};
return Pictures.collection.find({
_id: profile.pictureId
});
});

0 comments on commit 029b7d6

Please sign in to comment.