Skip to content

feat: return invite event#241

Merged
ggazzo merged 1 commit intomainfrom
feat/return-invite-event
Oct 1, 2025
Merged

feat: return invite event#241
ggazzo merged 1 commit intomainfrom
feat/return-invite-event

Conversation

@ggazzo
Copy link
Copy Markdown
Member

@ggazzo ggazzo commented Oct 1, 2025

Summary by CodeRabbit

  • New Features

    • Invitation responses now include detailed event information alongside room and event identifiers, enabling easier tracking and integration.
    • Improves downstream handling of invitations by providing a structured event object in the response.
  • Refactor

    • Internal service behavior updated to consistently return enriched invitation data. No changes required to end-user workflows or UI.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

InviteService.inviteUserToRoom now returns a payload including event_id, room_id, and a typed event created via PersistentEventFactory.createFromRawEvent based on the room’s version. Both early-return paths populate the new event field.

Changes

Cohort / File(s) Summary
Invite return payload update
packages/federation-sdk/src/services/invite.service.ts
Updated method signature to return { event_id, room_id, event }. Added creation of event via PersistentEventFactory.createFromRawEvent for both early-return code paths.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant InviteService
  participant PersistentEventFactory as EventFactory
  participant RoomStore as Room Version
  Caller->>InviteService: inviteUserToRoom(userId, roomId, sender, isDirectMessage?)
  InviteService->>RoomStore: getRoomVersion(roomId)
  RoomStore-->>InviteService: roomVersion
  Note over InviteService: Build raw m.room.member invite event
  InviteService->>EventFactory: createFromRawEvent(rawEvent, roomVersion)
  EventFactory-->>InviteService: PersistentEvent
  InviteService-->>Caller: { event_id, room_id, event }
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A rabbit taps code with a careful ear,
Invites now return events crystal clear.
Hop, hop—factory spins the thread,
Typed tales of members neatly spread.
In room and event, IDs align—
Carrots for tests; the build’s divine. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “feat: return invite event” succinctly highlights the main change of updating the InviteService to return the invite event payload, matching the updated method signature and key behavior introduced in the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests

❌ Error creating Unit Test PR.

  • Create PR with unit tests
  • Commit unit tests in branch feat/return-invite-event
  • Post copyable unit tests in a comment

📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 9f32b43 and 9e25d90.

📒 Files selected for processing (1)
  • packages/federation-sdk/src/services/invite.service.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/federation-sdk/src/services/invite.service.ts (2)
packages/federation-sdk/src/index.ts (2)
  • PersistentEventBase (21-21)
  • RoomVersion (22-22)
packages/room/src/manager/factory.ts (1)
  • PersistentEventFactory (30-122)
🔇 Additional comments (3)
packages/federation-sdk/src/services/invite.service.ts (3)

100-107: LGTM - Consistent event transformation.

The use of PersistentEventFactory.createFromRawEvent correctly transforms the raw event into a typed persistent event for the return payload.


130-137: LGTM - Consistent with the first return path.

The event transformation pattern matches the first return path, ensuring both code paths return the same payload shape.


40-44: No breaking changes—callers unaffected. Added event (and room_id) is returned but existing call sites either ignore the result or only extract event_id; returning extra properties is backward-compatible.

Likely an incorrect or invalid review comment.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ggazzo ggazzo force-pushed the feat/return-invite-event branch from 07e8676 to 9e25d90 Compare October 1, 2025 20:34
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.86%. Comparing base (9f32b43) to head (9e25d90).
⚠️ Report is 144 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #241   +/-   ##
=======================================
  Coverage   81.86%   81.86%           
=======================================
  Files          63       63           
  Lines        4709     4709           
=======================================
  Hits         3855     3855           
  Misses        854      854           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ggazzo ggazzo changed the title feat: retunr invite event feat: return invite event Oct 1, 2025
@ggazzo ggazzo marked this pull request as ready for review October 1, 2025 20:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 1, 2025

Note

Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants