Let friends invite each other into active rooms
- Vorherrschende Sprache
- JavaScript
- Sterne
- 30
- Forks
- 9
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
## Goal
Let a user turn an existing friendship into a race by sending a safe, actionable room invitation.
## Product contract
- A user may invite an accepted friend while the inviter is actively in the room.
- Any participant may invite a friend to a public room.
- Only the room owner/current admin may grant a private-room invitation.
- One active invite per room/invitee is deduplicated; resending refreshes the existing invitation rather than spamming duplicates.
- Invites expire after a documented short TTL and immediately become invalid when the room is deleted/hidden, the inviter loses authority, either user blocks the other, or the invite is revoked.
- The recipient can join or decline from the notification/friends UI.
- A private-room invite may bypass the password only for the exact authenticated invitee and room. It never bypasses bans, revealed-identity requirements, room availability, or server-side join checks.
## Data and API
Use a durable typed room-invite resource with inviter, invitee, room, state, expiry, and response timestamps. Notification records reference this resource; notification actions do not contain arbitrary callbacks. Use an opaque invite identifier in deep links and validate the authenticated recipient on every operation.
Coordinate the access-grant path with #156 so private-room approval and friend invitations do not become two incompatible authorization systems.
## Acceptance criteria
- [ ] Add create/list/decline/revoke/consume operations with idempotent state transitions and explicit authorization.
- [ ] Persist invites in MongoDB and add the corresponding non-blocking PostgreSQL mirror/migration.
- [ ] Create a typed in-app notification and realtime event without exposing room passwords or private room membership.
- [ ] Make successful joining consume the invite atomically enough to prevent replay while remaining retry-safe.
- [ ] Give clear UI feedback for expired, revoked, deleted-room, blocked, banned, and no-longer-authorized cases.
- [ ] Add tests for public/private rooms, owner/admin changes, duplicate sends, expiry, blocking, bans, identity requirements, replay, and reconnect.
- [ ] Add a two-user Cypress flow for invite → notification → join.
## Dependencies
- #75
- #105
- #153
- Related: #156
## Non-goals
- Anonymous invite links.
- Inviting arbitrary non-friends.
- Sharing or revealing private-room passwords.
Beitragsleitfaden
Rechercherichtung
Beginne damit, den Pfad zur Gewährung des Raumzugriffs aus #156 und die friends/notification UI nachzuverfolgen, und überprüfe anschließend die Anforderungen an die MongoDB-Persistenz und den PostgreSQL-Spiegel. Verifiziere die create-, list-, decline-, revoke- und consume-Operationen anhand der Kriterien für Autorisierung und Idempotenz. Schließe mit dem Cypress invite-to-join-Ablauf für zwei Benutzer sowie den aufgeführten Fällen für Ablauf, Blockierung, Bann, Replay und Wiederverbindung ab.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cypress, javascript, mongodb, node.js, postgresql, react
- Bereich
- api, authorization, backend, databases, frontend, full-stack, testing
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100