From b3d43fa12e028c5c1fe5e582a8bbef0183c2a73c Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 10 Jan 2017 16:59:36 -0200 Subject: [PATCH] API: Improve query of getIntegrations --- packages/rocketchat-api/server/v1/channels.js | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/rocketchat-api/server/v1/channels.js b/packages/rocketchat-api/server/v1/channels.js index 28c7acc5d52..1e091fc7b82 100644 --- a/packages/rocketchat-api/server/v1/channels.js +++ b/packages/rocketchat-api/server/v1/channels.js @@ -181,25 +181,13 @@ RocketChat.API.v1.addRoute('channels.getIntegrations', { authRequired: true }, { } let ourQuery = { - $or: [{ - channel: { - $in: [`#${findResult.name}`] - } - }] + channel: `#${findResult.name}` }; if (includeAllPublicChannels) { - ourQuery.$or.push({ - channel: { - $eq: [] - } - }); - - ourQuery.$or.push({ - channel: { - $in: ['all_public_channels'] - } - }); + ourQuery.channel = { + $in: [ourQuery.channel, 'all_public_channels'] + }; } const { offset, count } = this.getPaginationItems();