|
|
|
@ -317,8 +317,13 @@ RocketChat.API.v1.addRoute('groups.leave', { authRequired: true }, { |
|
|
|
|
RocketChat.API.v1.addRoute('groups.list', { authRequired: true }, { |
|
|
|
|
get() { |
|
|
|
|
const { offset, count } = this.getPaginationItems(); |
|
|
|
|
const { sort, fields } = this.parseJsonQuery(); |
|
|
|
|
let rooms = _.pluck(RocketChat.models.Subscriptions.findByTypeAndUserId('p', this.userId).fetch(), '_room'); |
|
|
|
|
const { sort, fields, query } = this.parseJsonQuery(); |
|
|
|
|
const ourQuery = Object.assign({}, query, { |
|
|
|
|
t: 'p', |
|
|
|
|
'u._id': this.userId |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let rooms = _.pluck(RocketChat.models.Subscriptions.find(ourQuery).fetch(), '_room'); |
|
|
|
|
const totalCount = rooms.length; |
|
|
|
|
|
|
|
|
|
rooms = RocketChat.models.Rooms.processQueryOptionsOnResult(rooms, { |
|
|
|
@ -344,8 +349,10 @@ RocketChat.API.v1.addRoute('groups.listAll', { authRequired: true }, { |
|
|
|
|
return RocketChat.API.v1.unauthorized(); |
|
|
|
|
} |
|
|
|
|
const { offset, count } = this.getPaginationItems(); |
|
|
|
|
const { sort, fields } = this.parseJsonQuery(); |
|
|
|
|
let rooms = RocketChat.models.Rooms.findByType('p').fetch(); |
|
|
|
|
const { sort, fields, query } = this.parseJsonQuery(); |
|
|
|
|
const ourQuery = Object.assign({}, query, { t: 'p' }); |
|
|
|
|
|
|
|
|
|
let rooms = RocketChat.models.Rooms.find(ourQuery).fetch(); |
|
|
|
|
const totalCount = rooms.length; |
|
|
|
|
|
|
|
|
|
rooms = RocketChat.models.Rooms.processQueryOptionsOnResult(rooms, { |
|
|
|
|