refactor(federation): improve runWithBackoff function#37116
refactor(federation): improve runWithBackoff function#37116ggazzo merged 5 commits intofix/old-fedfrom
Conversation
…moderator and owner methods
…room and enhance username validation logic
…et.chat/ui-contexts to version 23.0.0-rc.1 in package.json and yarn.lock
|
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 |
|
|
Caution Review failedThe pull request is closed. WalkthroughRemoves the federation-specific branch from addUsersToRoom and unregisters the related callback. Updates type signatures accordingly. Extends role methods’ room projections to include federation. Bumps @rocket.chat/federation-sdk to 0.1.13. Refactors federation-matrix invite/join flows, adds acceptInvite, introduces getUsernameServername, and threads HomeserverServices through event handlers. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant MeteorServer as Server Method addUsersToRoom
participant UserService as User/Subscriptions
participant Notifier
Client->>MeteorServer: addUsersToRoom({ rid, users })
Note over MeteorServer: Federated branch removed
loop for each username
MeteorServer->>UserService: find user by username
alt user already member
MeteorServer->>Notifier: notify already in room
else user not member
MeteorServer->>UserService: add user to room
MeteorServer->>Notifier: notify user added
end
end
MeteorServer-->>Client: boolean result
sequenceDiagram
autonumber
participant App as FederationMatrix
participant Homeserver as HomeserverServices
participant Accept as acceptInvite
App->>Homeserver: inviteUserToRoom(roomId, username)
Homeserver-->>App: invite sent/ack
App->>Accept: acceptInvite(inviteEvent, username, services)
Accept->>Homeserver: validate invite and join room (with backoff)
Homeserver-->>Accept: joined
Accept-->>App: done
sequenceDiagram
autonumber
participant HS as Homeserver (Matrix)
participant Events as registerEvents
participant Member as member()
participant Users as createOrUpdateFederatedUser
participant Rooms as Room/Subscriptions
HS-->>Events: m.room.member (join)
Events->>Member: membershipJoinAction(data, services)
Member->>Member: getUsernameServername(state_key, serverName)
alt user is local
Member->>Rooms: check existing subscription
alt subscription exists
Member-->>Events: skip add
else
Users->>Users: createOrUpdateFederatedUser({ username, origin, name })
Member->>Rooms: add user to room
end
else federated user
Users->>Users: createOrUpdateFederatedUser({ username (mxid), origin, name })
Member->>Rooms: add user to room
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (13)
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 |
Co-authored-by: Diego Sampaio [email protected]
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
Summary by CodeRabbit