diff --git a/.changeset/silly-shiny-kiwis.md b/.changeset/silly-shiny-kiwis.md new file mode 100644 index 0000000000000..427ff337079e9 --- /dev/null +++ b/.changeset/silly-shiny-kiwis.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Fixes `channels.list` endpoint from rejecting pagination parameters diff --git a/apps/meteor/tests/end-to-end/api/channels.ts b/apps/meteor/tests/end-to-end/api/channels.ts index 75aff5ad770af..0e105a728cd46 100644 --- a/apps/meteor/tests/end-to-end/api/channels.ts +++ b/apps/meteor/tests/end-to-end/api/channels.ts @@ -431,6 +431,16 @@ describe('[Channels]', () => { expect(res.body).to.have.property('total'); }); }); + + it('should paginate', async () => { + const { + body: { channels: channels1 }, + } = await request.get(api('channels.list')).set(credentials); + const { + body: { channels: channels2 }, + } = await request.get(api('channels.list')).set(credentials).query({ offset: 1 }); + expect(channels1).to.not.deep.equal(channels2); + }); }); it('/channels.list.joined', (done) => { diff --git a/packages/rest-typings/src/v1/channels/ChannelsListProps.ts b/packages/rest-typings/src/v1/channels/ChannelsListProps.ts index c1f0a6de84266..dd1101c1c00f2 100644 --- a/packages/rest-typings/src/v1/channels/ChannelsListProps.ts +++ b/packages/rest-typings/src/v1/channels/ChannelsListProps.ts @@ -6,18 +6,25 @@ const ajv = new Ajv({ coerceTypes: true, }); -export type ChannelsListProps = PaginatedRequest<{ _id?: string; query?: string }>; +export type ChannelsListProps = PaginatedRequest<{ _id?: string }>; const channelsListPropsSchema = { type: 'object', properties: { _id: { type: 'string', - nullable: true, }, query: { type: 'string', - nullable: true, + }, + count: { + type: 'number', + }, + offset: { + type: 'number', + }, + sort: { + type: 'string', }, }, required: [],