feat/fix-broken-routes
Summary
Fixes broken GoRouter navigation targets discovered during a full audit of all context.push() / context.go() calls against the router tree. Also implements the messaging API stubs that were silently no-ops (edit/delete/react), and wires the chat details screen danger zone and blocked users list to real Supabase operations.
Broken Routes Fixed
| File | Old (broken) | New (correct) |
|---|---|---|
event_details_screen.dart | /home/social/my-crews | /profile/my-crews |
search_screen.dart | /home/event-discovery | /home |
friends_screen.dart | /events/:id | /home/event-detail/:id |
social_list_screen.dart | /profile/:userId | /user/:userId |
GoRouter silently navigates to the error route on unknown paths — these failures had no visible crash, making them hard to catch without an explicit audit.
Messaging API Stubs Implemented
All stub methods in lib/core/network/messaging_api_service.dart that were returning null/false:
editMessage—UPDATE messages SET content, is_edited WHERE id AND sender_iddeleteMessage— soft-delete (is_deleted=true) for public history, hard delete for own messagesreactToMessage— callstoggle_message_reactionRPC (atomic JSONB toggle); gracefully falls back if RPC unavailableremoveReaction— delegates toreactToMessage(same toggle)addParticipants— upserts intochat_participantsremoveParticipant— deletes fromchat_participantsleaveChat— delegates toremoveParticipantfor current userdeleteChat— deletes chat row (owner only)updateChat— updates chat row and returns updated modelupdateParticipantRole— updates role inchat_participants
Chat Details Screen
Replaced “in arrivo” snackbars with real implementations:
- Leave group — confirmation dialog →
DELETE chat_participants→ navigate to/social - Block user — confirmation dialog →
UPSERT user_blocks→ navigate to/social - Clear chat — confirmation dialog →
DELETE messages WHERE chat_id→ refresh notifier
Privacy Settings — Blocked Users
_showBlockedUsersSheet now:
- Fetches from
user_blocksjoined withprofiles - Renders each blocked user with an “Sblocca” button
- Unblock is optimistic — removes from local list immediately on success
- Falls back to empty state if the table doesn’t exist yet
DB Migrations
| File | Description |
|---|---|
20260318000004_message_reactions_rpc.sql | toggle_message_reaction(message_id, user_id, emoji) — atomic JSONB toggle |
20260318000005_user_blocks.sql | user_blocks(blocker_id, blocked_id) with RLS |