Skip to content

Commit

Permalink
Fix issue cannot list channels by name (#12952)
Browse files Browse the repository at this point in the history
  • Loading branch information
huydang284 authored and ggazzo committed Mar 1, 2019
1 parent 8f40051 commit 8bddc37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/methods/channelsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ Meteor.methods({
if (channelType !== 'private') {
if (hasPermission(userId, 'view-c-room')) {
if (filter) {
channels = channels.concat(Rooms.findByType('c', options).fetch());
} else {
channels = channels.concat(Rooms.findByTypeAndNameContaining('c', filter, options).fetch());
} else {
channels = channels.concat(Rooms.findByType('c', options).fetch());
}
} else if (hasPermission(userId, 'view-joined-room')) {
const roomIds = Subscriptions.findByTypeAndUserId('c', userId, { fields: { rid: 1 } }).fetch().map((s) => s.rid);
if (filter) {
channels = channels.concat(Rooms.findByTypeInIds('c', roomIds, options).fetch());
} else {
channels = channels.concat(Rooms.findByTypeInIdsAndNameContaining('c', roomIds, filter, options).fetch());
} else {
channels = channels.concat(Rooms.findByTypeInIds('c', roomIds, options).fetch());
}
}
}
Expand All @@ -85,9 +85,9 @@ Meteor.methods({
if (!groupByType) {
const roomIds = Subscriptions.findByTypeAndUserId('p', userId, { fields: { rid: 1 } }).fetch().map((s) => s.rid);
if (filter) {
channels = channels.concat(Rooms.findByTypeInIds('p', roomIds, options).fetch());
} else {
channels = channels.concat(Rooms.findByTypeInIdsAndNameContaining('p', roomIds, filter, options).fetch());
} else {
channels = channels.concat(Rooms.findByTypeInIds('p', roomIds, options).fetch());
}
}
}
Expand Down

0 comments on commit 8bddc37

Please sign in to comment.