Permalink
Browse files

Step 15.6: Update users publication to handle addressbook contacts

  • Loading branch information...
darkbasic committed Jun 7, 2017
1 parent c7b393b commit b12f84f9b1e217ba184a5deff024d23ab2591164
Showing with 6 additions and 2 deletions.
  1. +6 −2 api/server/publications.ts
@@ -5,7 +5,8 @@ import { Chats } from './collections/chats';
import { Pictures } from './collections/pictures';
Meteor.publishComposite('users', function(
pattern: string
pattern: string,
contacts: string[]
): PublishCompositeConfig<User> {
if (!this.userId) {
return;
@@ -15,8 +16,11 @@ Meteor.publishComposite('users', function(
if (pattern) {
selector = {
'profile.name': { $regex: pattern, $options: 'i' }
'profile.name': { $regex: pattern, $options: 'i' },
'phone.number': {$in: contacts}
};
} else {
selector = {'phone.number': {$in: contacts}}
}
return {

0 comments on commit b12f84f

Please sign in to comment.