API: Improve query of getIntegrations

pull/5411/head
Rodrigo Nascimento 9 years ago
parent ffd787fceb
commit b3d43fa12e
No known key found for this signature in database
GPG Key ID: 2C85B3AFE75D23F9
  1. 20
      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();

Loading…
Cancel
Save