Files
TX/lib
riyadhafraa 62b79c7e7d Task #42: Tell members when someone leaves a group on their own
Original task: Post a bilingual system message into the group chat
when a member leaves via POST /api/conversations/:id/leave, with
real-time delivery via Socket.IO and rendering in the chat thread.

Findings:
- The leave handler in artifacts/api-server/src/routes/conversations.ts
  already inserts a `member_left` system message (and `admin_promoted`
  when a successor is auto-promoted) and emits via Socket.IO using
  insertAndEmitSystemMessage. Direct conversations and last-leaver
  cleanup paths are correctly skipped.
- artifacts/teaboy-os/src/pages/chat.tsx renderSystemMessage already
  handles `member_left`, `admin_promoted`, and `adminPromotedAfterLeave`.
- Bilingual locale keys exist in src/locales/en.json and ar.json under
  chat.system.memberLeft / adminPromoted / adminPromotedAfterLeave.

Change made:
- Extended the MessageWithSender.kind enum in lib/api-spec/openapi.yaml
  to include `member_left` and `admin_promoted` (previously only
  user/group_renamed/members_added/member_removed were declared).
- Re-ran `pnpm --filter @workspace/api-spec run codegen` to regenerate
  api-zod and api-client-react schemas so the spec, runtime validation,
  and client types stay in sync.
- Verified `pnpm -w run typecheck` passes across all packages.

No behavioural code changes were necessary; the feature was already
implemented end-to-end and only the API spec enum needed to catch up.

Replit-Task-Id: 40fccb3a-4fc0-4ad7-a6e9-d1ac67ef7769
2026-04-21 10:20:22 +00:00
..