-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add users invited by 3rd party #228
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
Conversation
WalkthroughUpdated the send-join service to emit membership events on a new channel, include a state_key set to the sender, and source avatar_url directly from the signed event content. Other content fields remain unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant S as SendJoinService
participant E as EventBus
Note over S: Build signed join event
C->>S: requestSendJoin()
S->>S: extract content (displayname, avatar_url)
S->>S: set state_key = sender
S->>E: emit "homeserver.matrix.membership"<br/>payload: { state_key, content.avatar_url, ... }
E-->>S: ack
S-->>C: result
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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 @@
## main #228 +/- ##
=======================================
Coverage 81.67% 81.67%
=======================================
Files 63 63
Lines 4682 4682
=======================================
Hits 3824 3824
Misses 858 858 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 (1)
packages/federation-sdk/src/services/send-join.service.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/federation-sdk/src/services/send-join.service.ts (2)
packages/room/src/manager/v3.ts (1)
eventId(22-34)packages/room/src/manager/event-wrapper.ts (1)
roomId(75-77)
| this.emitterService.emit('homeserver.matrix.membership', { | ||
| event_id: eventId, | ||
| room_id: roomId, | ||
| sender: signedJoinEvent.sender, | ||
| state_key: signedJoinEvent.sender, | ||
| origin_server_ts: signedJoinEvent.originServerTs, |
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.
Restore state_key to target user instead of sender
For m.room.member events the state_key must always be the user whose membership state is changing. Invites, kicks, bans, and third‑party invites all have sender !== state_key. By copying the sender here we’ll publish the wrong membership target, so downstream consumers will update the inviter rather than the invitee—precisely what this PR is trying to fix. Please pull the actual state key from the event payload instead.
- state_key: signedJoinEvent.sender,
+ state_key: signedJoinEvent.event.state_key,🤖 Prompt for AI Agents
packages/federation-sdk/src/services/send-join.service.ts around lines 74 to 79:
the emitted m.room.member payload sets state_key to the sender, which is
incorrect for membership events; change the code to read the actual state key
from the signed event payload (use the event's state_key property — e.g.
signedJoinEvent.state_key or signedJoinEvent.stateKey depending on naming) and
emit that as state_key so the membership target (invitee/kicked/banned user) is
published correctly.
Summary by CodeRabbit