fix: address read receipt pagination gaps in #41720
Closed
AL
2mo ago+111+111+012345678901234567890123456789-7-7-0123456789
Proposed changes (including videos or screenshots)
This is an independent follow-up to #41720 for its unresolved pagination coverage gap.
- Accept validated non-negative integer
offsetandcountquery parameters. - Forward pagination through the REST handler and read receipt retrieval path.
- Apply Rocket.Chat's standard default count, upper limit, and infinite count policy when pagination is requested.
- Paginate after hot and archived receipts are deduplicated, before resolving users.
- Preserve the existing unpaginated response when neither parameter is supplied.
- Add focused regression coverage for offset, count, user resolution, and unlimited
count=0behavior.
Issue(s)
Related to #41719.
Follow-up to #41720.
Steps to test or reproduce
- Call
GET /api/v1/chat.getMessageReadReceiptswith a validmessageId,offset, andcount. - Confirm
offsetshifts the receipt window andcountlimits it. - Confirm negative or fractional pagination values are rejected.
- Confirm calls without pagination parameters still return the existing full receipt list.
Verified locally with:
corepack yarn exec mocha --config .mocharc.base.json ee/tests/unit/server/lib/message-read-receipt/ReadReceipt.spec.ts: 2 passing.- ESLint on all changed TypeScript files: passed.
corepack yarn workspace @rocket.chat/rest-typings typecheck: passed.- Focused schema smoke test: numeric query strings coerced; negative and fractional values rejected.
- Prettier check on all changed files: passed.
git diff --check: passed.
The full Rocket.Chat unit, API, and end-to-end suites were not run.
Further comments
The regression was developed test-first. Before the implementation, the offset/count test returned all three receipts. A second red-green cycle caught the standard count=0 unlimited case.
Summary by CodeRabbit
-
New Features
- Added optional
offsetandcountpagination parameters to message read-receipt requests. - Retrieve specific receipt ranges while preserving existing behavior when pagination is omitted.
- A
countof0returns all receipts from the requested offset onward.
- Added optional
-
Bug Fixes
- Added validation to ensure pagination values are non-negative integers.
-
Tests
- Added coverage for offset and count pagination scenarios.