Skip to content
Snippets Groups Projects
Commit d82d02d1 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Rename onlineUsers to filteredUsers

parent e56c2238
No related branches found
No related tags found
No related merge requests found
@onlineUsers = new Mongo.Collection 'online-users' @filteredUsers = new Mongo.Collection 'filtered-users'
Template.messagePopupConfig.helpers Template.messagePopupConfig.helpers
popupUserConfig: -> popupUserConfig: ->
...@@ -6,14 +6,14 @@ Template.messagePopupConfig.helpers ...@@ -6,14 +6,14 @@ Template.messagePopupConfig.helpers
template = Template.instance() template = Template.instance()
config = config =
title: 'People' title: 'People'
collection: onlineUsers collection: filteredUsers
template: 'messagePopupUser' template: 'messagePopupUser'
getInput: self.getInput getInput: self.getInput
textFilterDelay: 200 textFilterDelay: 200
getFilter: (collection, filter) -> getFilter: (collection, filter) ->
exp = new RegExp(filter, 'i') exp = new RegExp(filter, 'i')
Meteor.subscribe 'onlineUsers', filter Meteor.subscribe 'filteredUsers', filter
items = onlineUsers.find({$or: [{name: exp}, {username: exp}]}, {limit: 5}).fetch() items = filteredUsers.find({$or: [{name: exp}, {username: exp}]}, {limit: 5}).fetch()
all = all =
_id: '@all' _id: '@all'
...@@ -121,4 +121,4 @@ Template.messagePopupConfig.helpers ...@@ -121,4 +121,4 @@ Template.messagePopupConfig.helpers
return results return results
return config return config
\ No newline at end of file
Meteor.publish 'onlineUsers', (name) -> Meteor.publish 'filteredUsers', (name) ->
unless this.userId unless this.userId
return this.ready() return this.ready()
console.log '[publish] onlineUsers'.green, name console.log '[publish] filteredUsers'.green, name
exp = new RegExp(name, 'i') exp = new RegExp(name, 'i')
...@@ -29,13 +29,13 @@ Meteor.publish 'onlineUsers', (name) -> ...@@ -29,13 +29,13 @@ Meteor.publish 'onlineUsers', (name) ->
cursorHandle = Meteor.users.find(query, options).observeChanges cursorHandle = Meteor.users.find(query, options).observeChanges
added: (_id, record) -> added: (_id, record) ->
pub.added('online-users', _id, record) pub.added('filtered-users', _id, record)
changed: (_id, record) -> changed: (_id, record) ->
pub.changed('online-users', _id, record) pub.changed('filtered-users', _id, record)
removed: (_id, record) -> removed: (_id, record) ->
pub.removed('online-users', _id, record) pub.removed('filtered-users', _id, record)
@ready() @ready()
@onStop -> @onStop ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment