Permalink
Browse files

Step 15.6: Update users publication to handle addressbook contacts

  • Loading branch information...
darkbasic committed Jun 7, 2017
1 parent 4685740 commit 3c6d0222647e98e49c4eeae0b5985edfd246bd89
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 3c6d022

Please sign in to comment.