|
|
|
|
@ -12,7 +12,7 @@ Meteor.publish 'roomSearch', (selector, options, collName) -> |
|
|
|
|
delete selector.type |
|
|
|
|
|
|
|
|
|
if not searchType? or searchType is 'u' |
|
|
|
|
subHandleUsers = RocketChat.models.Users.find(selector, { limit: 10, fields: { name: 1, username: 1, status: 1 } }).observeChanges |
|
|
|
|
subHandleUsers = RocketChat.models.Users.find(selector, { limit: 10, fields: { name: 1, username: 1, status: 1 }, sort: { name: 1 } }).observeChanges |
|
|
|
|
added: (id, fields) -> |
|
|
|
|
data = { type: 'u', uid: id, name: fields.name, username: fields.username, status: fields.status } |
|
|
|
|
self.added("autocompleteRecords", id, data) |
|
|
|
|
@ -22,7 +22,7 @@ Meteor.publish 'roomSearch', (selector, options, collName) -> |
|
|
|
|
self.removed("autocompleteRecords", id) |
|
|
|
|
|
|
|
|
|
if not searchType? or searchType is 'r' |
|
|
|
|
subHandleRooms = RocketChat.models.Rooms.findByTypesAndNotUserIdContainingUsername(RocketChat.roomTypes.getIdentifiers('d'), selector.uid?.$ne, RocketChat.models.Users.findOneById(this.userId).username, { limit: 10, fields: { t: 1, name: 1 } }).observeChanges |
|
|
|
|
subHandleRooms = RocketChat.models.Rooms.findByTypesAndNotUserIdContainingUsername(RocketChat.roomTypes.getIdentifiers('d'), selector.uid?.$ne, RocketChat.models.Users.findOneById(this.userId).username, { limit: 10, fields: { t: 1, name: 1 }, sort: { name: 1 } }).observeChanges |
|
|
|
|
added: (id, fields) -> |
|
|
|
|
data = { type: 'r', rid: id, name: fields.name, t: fields.t } |
|
|
|
|
self.added("autocompleteRecords", id, data) |
|
|
|
|
|