chore: migrate rooms.muteUser and rooms.unmuteUser endpoints to the new pattern#39414
chore: migrate rooms.muteUser and rooms.unmuteUser endpoints to the new pattern#39414mdawoud27 wants to merge 4 commits intoRocketChat:developfrom
rooms.muteUser and rooms.unmuteUser endpoints to the new pattern#39414Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: 5077ef8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughMoved mute/unmute room endpoints into the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present. |
ahmed-n-abdeltwab
left a comment
There was a problem hiding this comment.
where are the remaining steps?
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/meteor/app/api/server/v1/rooms.ts`:
- Around line 1202-1258: The REST typings declare the POST handlers for
rooms.muteUser and rooms.unmuteUser as returning void, but the endpoints
actually respond with { success: true }; update the REST type signatures (the
POST: (...) => void entries) for rooms.muteUser and rooms.unmuteUser to return {
success: true } instead, and if there are corresponding ValidateFunction
generics (e.g., ValidateFunction<void>) change them to ValidateFunction<{
success: true }> so the TypeScript types match the ajv/OpenAPI response shape.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2c573842-cc55-40a1-b1c5-3f130adfc833
📒 Files selected for processing (1)
apps/meteor/app/api/server/v1/rooms.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/app/api/server/v1/rooms.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:18.785Z
Learning: In Rocket.Chat PR reviews, maintain strict scope boundaries—when a PR is focused on a specific endpoint (e.g., rooms.favorite), avoid reviewing or suggesting changes to other endpoints that were incidentally refactored (e.g., rooms.invite) unless explicitly requested by maintainers.
📚 Learning: 2026-02-24T19:09:01.522Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:01.522Z
Learning: In Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1, avoid introducing logic changes. Only perform scope-tight changes that preserve behavior; style-only cleanups (e.g., removing inline comments) may be deferred to follow-ups to keep the migration PR focused.
Applied to files:
apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2026-02-23T17:53:06.802Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:06.802Z
Learning: During PR reviews that touch endpoint files under apps/meteor/app/api/server/v1, enforce strict scope: if a PR targets a specific endpoint (e.g., rooms.favorite), do not propose changes to unrelated endpoints (e.g., rooms.invite) unless maintainers explicitly request them. Focus feedback on the touched endpoint's behavior, API surface, and related tests; avoid broad cross-endpoint changes in the same PR unless requested.
Applied to files:
apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/app/api/server/v1/rooms.ts
🔇 Additional comments (1)
apps/meteor/app/api/server/v1/rooms.ts (1)
1198-1200: Return success fromrooms.leave.This keeps the handler consistent with the declared
200response in the chainedroomEndpointsdefinition.
38c458b to
957b56b
Compare
|
@ahmed-n-abdeltwab Do you mean swagger tests and changeset file or something else? |
we are getting to this later but first you need to clean the APIs from the rest-typings props, take a look at this example #36916 |
957b56b to
a77cc9e
Compare
…he new pattern with AJV validation
a77cc9e to
03b6340
Compare
|
@ahmed-n-abdeltwab take a look |
ahmed-n-abdeltwab
left a comment
There was a problem hiding this comment.
LGTM but last thing you need to create a changeset file
|
@ahmed-n-abdeltwab done 🫡 |
b280553 to
a221f30
Compare
There was a problem hiding this comment.
This should for simplicity be replaced with type RoomEndpoints = ExtractRoutesFromAPI;. The endpoints migrated to the new pattern should be chained together. For a reference, take a look at the example in #39094
|
@ahmed-n-abdeltwab, Yeah, I noticed that too and it confused me a bit at first 😅 Also following the rule of “if it works, don’t touch it” 😄 |
no problem, im here for you to guide you |
|
Thanks! I really appreciate this. I noticed there are some failed tests, such as |
Try debugging it. If the problem is with the PR APIs, then we need to address or fix it. If not, it's recommended to make the PR as concise and clean as possible. Also, so I don't forget, you should test the PR APIs locally and make sure they are green. And run eslint fix inside the Meteor folder for these files. |
1aca1e0 to
a952772
Compare
There was a problem hiding this comment.
why did you touch this file?
There was a problem hiding this comment.
why did you touch this file?
because there were failing tests especially in /rooms.delete and rooms.membersOrderedByRole
should I have avoided doing that?
There was a problem hiding this comment.
why did you touch this file?
because there were failing tests especially in
/rooms.deleteandrooms.membersOrderedByRoleshould I have avoided doing that?
@ahmed-n-abdeltwab friendly ping
There was a problem hiding this comment.
should I have avoided doing that?
yes, you should avoid editing the test file or any file unrelated to the migration
There was a problem hiding this comment.
yes, you should avoid editing the test file or any file unrelated to the migration
Thanks for the clarification @ahmed-n-abdeltwab.
I've reverted the changes to the test file
a952772 to
9860f8a
Compare
|
@ggazzo could you please review this PR |
|
Hey @mdawoud27, thank you for your contribution! 🙏 These endpoints have already been migrated as part of #39553, which consolidated all OpenAPI migrations to make it easier to test and validate everything as a single unit. That PR has been merged into |

Proposed changes (including videos or screenshots)
Migrates the
rooms.muteUserandrooms.unmuteUserendpoints from the legacyAPI.v1.addRoutepattern to the new OpenAPI-compliant format using AJV schema validation, added explicit response schemas for200,400, and401status codes, business logic unchangedTesting
Run the server locally with
TEST_MODE=true yarn devThen run the test commands and confirm all tests pass
Part of the ongoing REST API migration effort: RocketChat/Rocket.Chat-Open-API#150
Summary by CodeRabbit
Bug Fixes
Refactor