From b63f10da790c8530cf651d9e91f83cdc347097e1 Mon Sep 17 00:00:00 2001 From: Huy Dang Date: Fri, 14 Dec 2018 11:20:13 +0700 Subject: [PATCH] Fix issue cannot list channels by name --- server/methods/channelsList.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/methods/channelsList.js b/server/methods/channelsList.js index 4e4c6dab90b1..03f634316220 100644 --- a/server/methods/channelsList.js +++ b/server/methods/channelsList.js @@ -53,16 +53,16 @@ Meteor.methods({ if (channelType !== 'private') { if (RocketChat.authz.hasPermission(userId, 'view-c-room')) { if (filter) { - channels = channels.concat(RocketChat.models.Rooms.findByType('c', options).fetch()); - } else { channels = channels.concat(RocketChat.models.Rooms.findByTypeAndNameContaining('c', filter, options).fetch()); + } else { + channels = channels.concat(RocketChat.models.Rooms.findByType('c', options).fetch()); } } else if (RocketChat.authz.hasPermission(userId, 'view-joined-room')) { const roomIds = RocketChat.models.Subscriptions.findByTypeAndUserId('c', userId, { fields: { rid: 1 } }).fetch().map((s) => s.rid); if (filter) { - channels = channels.concat(RocketChat.models.Rooms.findByTypeInIds('c', roomIds, options).fetch()); - } else { channels = channels.concat(RocketChat.models.Rooms.findByTypeInIdsAndNameContaining('c', roomIds, filter, options).fetch()); + } else { + channels = channels.concat(RocketChat.models.Rooms.findByTypeInIds('c', roomIds, options).fetch()); } } } @@ -81,9 +81,9 @@ Meteor.methods({ if (!groupByType) { const roomIds = RocketChat.models.Subscriptions.findByTypeAndUserId('p', userId, { fields: { rid: 1 } }).fetch().map((s) => s.rid); if (filter) { - channels = channels.concat(RocketChat.models.Rooms.findByTypeInIds('p', roomIds, options).fetch()); - } else { channels = channels.concat(RocketChat.models.Rooms.findByTypeInIdsAndNameContaining('p', roomIds, filter, options).fetch()); + } else { + channels = channels.concat(RocketChat.models.Rooms.findByTypeInIds('p', roomIds, options).fetch()); } } }