parent
44ebe17991
commit
e06fb74e97
@ -1,3 +1,4 @@ |
||||
<template name="messagePopupChannel"> |
||||
<i class="{{icon}}"></i> |
||||
{{name}} |
||||
</template> |
||||
</template> |
||||
|
||||
@ -0,0 +1,5 @@ |
||||
Template.messagePopupChannel.helpers({ |
||||
icon() { |
||||
return RocketChat.roomTypes.getIcon(this.t); |
||||
} |
||||
}); |
||||
@ -1,36 +0,0 @@ |
||||
Meteor.publish 'channelAutocomplete', (name) -> |
||||
unless this.userId |
||||
return this.ready() |
||||
|
||||
pub = this |
||||
|
||||
options = |
||||
fields: |
||||
_id: 1 |
||||
name: 1 |
||||
limit: 5 |
||||
sort: |
||||
name: 1 |
||||
|
||||
roomIds = [] |
||||
if not RocketChat.authz.hasPermission(this.userId, 'view-c-room') and RocketChat.authz.hasPermission(this.userId, 'view-joined-room') |
||||
roomIds = _.pluck RocketChat.models.Subscriptions.findByUserId(this.userId).fetch(), 'rid' |
||||
|
||||
hasPermission = (_id) => |
||||
return RocketChat.authz.hasPermission(this.userId, 'view-c-room') or (RocketChat.authz.hasPermission(this.userId, 'view-joined-room') and roomIds.indexOf(_id) isnt -1) |
||||
|
||||
cursorHandle = RocketChat.models.Rooms.findByNameContainingAndTypes(name, ['c'], options).observeChanges |
||||
added: (_id, record) -> |
||||
if hasPermission(_id) |
||||
pub.added('channel-autocomplete', _id, record) |
||||
changed: (_id, record) -> |
||||
if hasPermission(_id) |
||||
pub.changed('channel-autocomplete', _id, record) |
||||
removed: (_id, record) -> |
||||
if hasPermission(_id) |
||||
pub.removed('channel-autocomplete', _id, record) |
||||
|
||||
@ready() |
||||
@onStop -> |
||||
cursorHandle.stop() |
||||
return |
||||
@ -1,34 +0,0 @@ |
||||
Meteor.publish 'filteredUsers', (selector) -> |
||||
unless this.userId |
||||
return this.ready() |
||||
|
||||
if not _.isObject selector |
||||
return this.ready() |
||||
|
||||
options = |
||||
fields: |
||||
name: 1 |
||||
username: 1 |
||||
|
||||
sort: |
||||
username: 1 |
||||
limit: 5 |
||||
|
||||
pub = this |
||||
|
||||
exceptions = selector.except or [] |
||||
|
||||
cursorHandle = RocketChat.models.Users.findByActiveUsersUsernameExcept(selector.name, exceptions, options).observeChanges |
||||
added: (_id, record) -> |
||||
pub.added('filtered-users', _id, record) |
||||
|
||||
changed: (_id, record) -> |
||||
pub.changed('filtered-users', _id, record) |
||||
|
||||
removed: (_id, record) -> |
||||
pub.removed('filtered-users', _id, record) |
||||
|
||||
@ready() |
||||
@onStop -> |
||||
cursorHandle.stop() |
||||
return |
||||
Loading…
Reference in new issue