-
Notifications
You must be signed in to change notification settings - Fork 13k
fix(federation): can't add local and remote users together via room creation modal #37208
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
fix(federation): can't add local and remote users together via room creation modal #37208
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 |
|
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.
Pull Request Overview
This PR fixes an issue where local and remote users couldn't be added together via the room creation modal in the federation system. The fix refactors the room creation logic to properly handle inviting members to federated rooms.
- Removes inline user invitation logic from room creation
- Adds proper federated room validation before inviting users
- Delegates user invitation to a dedicated method for better handling of mixed local/remote users
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| await this.homeserverServices.invite.inviteUserToRoom(userIdSchema.parse(member), matrixRoomResult.room_id, matrixUserId); | ||
| if (federatedRoom && isRoomNativeFederated(federatedRoom)) { | ||
| await this.inviteUsersToRoom(federatedRoom, members.filter(m => m != owner.username), owner); |
Copilot
AI
Oct 10, 2025
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.
Use strict inequality operator (!==) instead of loose inequality (!=) for better type safety and consistency.
| await this.inviteUsersToRoom(federatedRoom, members.filter(m => m != owner.username), owner); | |
| await this.inviteUsersToRoom(federatedRoom, members.filter(m => m !== owner.username), owner); |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAfter creating and marking a Matrix room as federated, the code now loads the federated room record and, if the room is native-federated, performs a single consolidated Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App as App Server
participant Matrix as Matrix HS
participant FedStore as Federated Room Store
User->>App: Create federated room (with members)
App->>Matrix: createRoom()
Matrix-->>App: roomId
App->>FedStore: Rooms.findOneById(roomId)
FedStore-->>App: federatedRoom | null
alt federatedRoom exists AND isRoomNativeFederated(federatedRoom)
App->>App: filter members (exclude owner)
App->>Matrix: inviteUsersToRoom(roomId, members[])
Matrix-->>App: invites sent
else Non-federated or non-native
App->>App: Skip batch invites (retain prior per-member or no-invite behavior)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-7.11.0 #37208 +/- ##
==================================================
- Coverage 66.37% 66.35% -0.02%
==================================================
Files 3386 3386
Lines 115619 115619
Branches 21351 21356 +5
==================================================
- Hits 76739 76723 -16
- Misses 36275 36286 +11
- Partials 2605 2610 +5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
785f505 to
feb682a
Compare
feb682a to
36f53dc
Compare
https://rocketchat.atlassian.net/browse/FDR-237
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
Summary by CodeRabbit
New Features
Refactor
Impact