-
Notifications
You must be signed in to change notification settings - Fork 12.6k
feat: Disabled voice actions in federated rooms #37714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
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 |
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis PR adds federated-room checks to media call action hooks, preventing voice calling functionality in federated rooms. It includes comprehensive test coverage for both hooks and updates mock infrastructure to handle subscription states during testing. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx(1 hunks)apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.ts(4 hunks)apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.spec.tsx(1 hunks)apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts(2 hunks)apps/meteor/tests/mocks/client/FakeRoomProvider.tsx(1 hunks)packages/mock-providers/src/MockedAppRootBuilder.tsx(3 hunks)
🧰 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/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.spec.tsxapps/meteor/client/hooks/roomActions/useMediaCallRoomAction.tsapps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsxpackages/mock-providers/src/MockedAppRootBuilder.tsxapps/meteor/tests/mocks/client/FakeRoomProvider.tsxapps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts
🧠 Learnings (15)
📓 Common learnings
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37408
File: apps/meteor/client/views/admin/ABAC/useRoomAttributeOptions.tsx:53-69
Timestamp: 2025-11-10T19:06:20.146Z
Learning: In the Rocket.Chat repository, do not provide suggestions or recommendations about code sections marked with TODO comments. The maintainers have already identified these as future work and external reviewers lack the full context about implementation plans and timing.
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Applied to files:
apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.spec.tsxapps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests
Applied to files:
apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.spec.tsxapps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.tsapps/meteor/tests/mocks/client/FakeRoomProvider.tsxapps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.tsapps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings by mapping subscription documents to room IDs, never undefined, even when user has no room subscriptions.
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.tspackages/mock-providers/src/MockedAppRootBuilder.tsxapps/meteor/tests/mocks/client/FakeRoomProvider.tsxapps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings (mapping subscription documents to room IDs), never undefined, even when user has no room subscriptions.
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.tspackages/mock-providers/src/MockedAppRootBuilder.tsxapps/meteor/tests/mocks/client/FakeRoomProvider.tsxapps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts
📚 Learning: 2025-11-19T18:20:37.116Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests
Applied to files:
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.
Applied to files:
packages/mock-providers/src/MockedAppRootBuilder.tsx
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: UserBridge.doGetUserRoomIds in packages/apps-engine/src/server/bridges/UserBridge.ts has a bug where it implicitly returns undefined when the app lacks read permission (missing return statement in the else case of the permission check).
Applied to files:
apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts
🧬 Code graph analysis (6)
apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.spec.tsx (3)
apps/meteor/tests/mocks/data.ts (3)
createFakeUser(32-44)createFakeRoom(46-61)createFakeSubscription(63-90)apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts (1)
useUserMediaCallAction(9-55)packages/mock-providers/src/index.ts (1)
mockAppRoot(3-3)
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.ts (4)
packages/ui-contexts/src/index.ts (2)
useUserId(84-84)RoomToolboxActionConfig(9-9)packages/ui-contexts/src/hooks/useUserId.ts (1)
useUserId(5-5)packages/core-typings/src/IRoom.ts (1)
isRoomFederated(122-122)packages/ui-contexts/src/RoomToolboxContext.ts (1)
RoomToolboxActionConfig(13-32)
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx (3)
apps/meteor/tests/mocks/data.ts (3)
createFakeUser(32-44)createFakeRoom(46-61)createFakeSubscription(63-90)packages/mock-providers/src/index.ts (1)
mockAppRoot(3-3)apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.ts (1)
useMediaCallRoomAction(26-75)
packages/mock-providers/src/MockedAppRootBuilder.tsx (1)
packages/ui-contexts/src/index.ts (1)
SubscriptionWithRoom(109-109)
apps/meteor/tests/mocks/client/FakeRoomProvider.tsx (1)
apps/meteor/tests/mocks/data.ts (1)
createFakeSubscription(63-90)
apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts (2)
packages/ui-contexts/src/index.ts (1)
useUserRoom(86-86)packages/core-typings/src/IRoom.ts (1)
isRoomFederated(122-122)
⏰ 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). (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🔇 Additional comments (11)
apps/meteor/tests/mocks/client/FakeRoomProvider.tsx (1)
20-20: LGTM - Improved test determinism.The unconditional subscription creation ensures consistent test behavior and aligns with the PR's test infrastructure improvements.
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.ts (2)
27-31: LGTM - Federated room guard implemented correctly.The room retrieval and federation check correctly implement the PR objective to disable voice actions in federated rooms.
59-74: LGTM - Memoization correctly includes federated state.The early return and dependency array correctly handle the federated room scenario, ensuring actions are disabled for federated rooms.
apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.ts (1)
17-23: LGTM - Federated room guard implemented correctly.The federated room check is correctly placed early in the guard clause chain and properly disables the media call action for federated rooms.
apps/meteor/client/hooks/roomActions/useMediaCallRoomAction.spec.tsx (2)
1-43: LGTM - Well-structured test setup.The test setup with mocks and the
appRoothelper function provides flexible configuration for comprehensive test scenarios.
45-146: LGTM - Comprehensive test coverage.The test suite covers all critical edge cases including the new federated room guard, ensuring the hook behaves correctly across all scenarios.
apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useUserMediaCallAction.spec.tsx (2)
1-26: LGTM - Appropriate test mocking setup.The mock configuration correctly sets up the required contexts for testing the
useUserMediaCallActionhook.
27-145: LGTM - Thorough test coverage with proper assertions.The test suite validates all guard conditions including the new federated room check, and properly tests the action's behavior including translations and handler invocations.
packages/mock-providers/src/MockedAppRootBuilder.tsx (3)
207-207: LGTM - Appropriate field addition.The new
subscriptionfield correctly supports single-subscription test scenarios.
455-459: LGTM - Consistent builder method.The
withSubscriptionmethod follows the established builder pattern and enables single-subscription test setup.
151-152: Remove this comment—the spread operation is already safe.Line 152 already includes
(this.subscriptions ?? []), which safely handles the case wherethis.subscriptionsis undefined. The code correctly returns an empty array whenthis.subscriptionis falsy. The suggested diff changes the logic unnecessarily by returningthis.subscriptionsinstead of[]whenthis.subscriptiondoesn't exist, which alters the intended behavior.Likely an incorrect or invalid review comment.
4c9ccf0 to
e38ce4b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #37714 +/- ##
===========================================
+ Coverage 67.78% 67.80% +0.02%
===========================================
Files 3449 3449
Lines 113987 113994 +7
Branches 20956 20958 +2
===========================================
+ Hits 77262 77293 +31
+ Misses 34610 34582 -28
- Partials 2115 2119 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
Issue(s)
FB-46
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.