Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silly-shiny-kiwis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes `channels.list` endpoint from rejecting pagination parameters
10 changes: 10 additions & 0 deletions apps/meteor/tests/end-to-end/api/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
13 changes: 10 additions & 3 deletions packages/rest-typings/src/v1/channels/ChannelsListProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down
Loading