Skip to content

Commit

Permalink
Step 13.29: Add user publication
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and darkbasic committed Jun 13, 2017
1 parent 5a0186d commit 0c4f9d8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/server/publications.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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 0c4f9d8

Please sign in to comment.