mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 21:48:18 +01:00
- Fix currency defaults (SATS → CHF) across forms, configs, and API routes - Remove @ts-nocheck from socialService.ts and improve type safety - Replace console.log statements with proper logger utility in production code - Additional type safety improvements and code quality enhancements - Documentation updates for improved maintainability All changes follow DRY, SSOT, and separation of concerns principles.
2.4 KiB
2.4 KiB
Messaging System Notes
created_date: 2025-12-08
last_modified_date: 2025-12-11
last_modified_summary: Link avatars/names in DM list and header to profiles
- Conversations now load via
get_user_conversationsRPC to avoid duplicate rows from older views. - Detail view fallback uses
conversation_detailswith a safemaybeSingleto prevent "Conversation not found" when multiple rows existed. - New migration
20251208_grant_messaging_permissions.sqlgrants authenticated users access to messaging views/functions. - Removed console logging in the new conversation modal to keep production logs clean.
- Validate after deploy: open
/messages, start a new conversation, and send/receive replies between two users. - Next.js 15 requires awaiting route
params;messages/[conversationId]handlers now awaitparamsto avoid runtime errors. - Dev-only auto-migration call to
/api/admin/apply-messaging-migrationsnow records failed attempts to prevent repeated 500s whenSUPABASE_ACCESS_TOKENis missing; run the migrations manually when credentials are unavailable. - Auth state changes post to
/api/auth/callbackand also prime the current session on mount so Supabase cookies stay in sync and/api/messageshandlers don’t return 401 on first load. - Conversation fetch now trusts
get_user_conversationsscoping for auth, and if that fails, falls back to any participant row (even inactive) plus a minimal conversation fetch to avoid false 403s that were triggering the new-conversation modal. /api/profilesnow returns a standard paginated array shape (withmetadatafor page/limit/total) so the new-conversation picker renders user rows and search results correctly.- Messages UI now mirrors the split-view DM layout (tabs, refined search, softer empty state with primary CTA) to make starting or finding chats easier.
- Conversation list rows are tightened to the X/Twitter DM look; long-press to enter selection mode on touch, drag across rows (mouse or touch) to select/deselect quickly, and unread chips surface request-like items when the Requests tab is active.
- Message bubbles now show WhatsApp-style delivery/read ticks: single gray = sent, double gray = delivered to someone, double colored = read by all recipients; pending/failed still show inline.
- Bulk delete flows now confirm when removing multiple items and surface success/error toasts for conversations and in-thread message deletes.