fix: Invite to Room now creates a pending invitation instead of adding member directly (#3239) - #3269
Open
aaniya22 wants to merge 2 commits into
Open
Conversation
…g member directly (Priyanshu-byte-coder#3239) - Added room_invitations table (migration + schema.sql) with pending/ accepted/declined status - invite/route.ts now creates a pending invitation and notifies the invitee, instead of calling addRoomMember directly - Added GET /api/room-invitations to list a user's pending invitations - Added POST /api/room-invitations/[invitationId] to accept or decline - Added PendingInvitations component, surfaced on the rooms list page - InviteModal now shows a pending-confirmation state instead of optimistically closing - MembersPanel no longer adds the invited user to the members list on invite, since they aren't a member until they accept Signed-off-by: aaniya22 <aaniyaatomar@gmail.com>
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The "Invite to Room" feature previously added a GitHub user as a full room member immediately, with no consent step. This PR introduces a proper pending-invitation flow: invites create a
room_invitationsrecord and notify the invitee, who must accept before becoming a member.Closes #3239
Type of Change
What Changed
room_invitationstable (migration +schema.sql) withpending/accepted/declinedstatus and RLS policysrc/app/api/rooms/[roomId]/invite/route.tsnow creates a pending invitation and sends a notification, instead of callingaddRoomMemberdirectlyGET /api/room-invitationsto list a user's pending invitationsPOST /api/room-invitations/[invitationId]to accept or decline an invitationsrc/components/rooms/PendingInvitations.tsx, surfaced on the rooms list pageInviteModalnow shows a pending-confirmation message instead of optimistically closingMembersPanelno longer adds the invited user to the members list on invite, since they aren't a member until they acceptRoomInvitationtype insrc/types/rooms.tsHow to Test
Expected result: Inviting a user creates a pending invitation and notification; the invited user must explicitly accept before becoming a room member.
Screenshots / Recordings
N/A — can add if requested during review.
Checklist
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Accessibility (UI changes only)
Additional Context
This is a schema change requiring a new migration (
supabase/migrations/20260729041910_add_room_invitations.sql) to be applied before merge. No automated tests were added for the new invitation flow yet — existingrooms.test.tsandrooms-messages.test.ts(16 tests) still pass unaffected. Happy to add coverage for the accept/decline endpoints if desired before merge.