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

FileOld (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:

  • editMessageUPDATE messages SET content, is_edited WHERE id AND sender_id
  • deleteMessage — soft-delete (is_deleted=true) for public history, hard delete for own messages
  • reactToMessage — calls toggle_message_reaction RPC (atomic JSONB toggle); gracefully falls back if RPC unavailable
  • removeReaction — delegates to reactToMessage (same toggle)
  • addParticipants — upserts into chat_participants
  • removeParticipant — deletes from chat_participants
  • leaveChat — delegates to removeParticipant for current user
  • deleteChat — deletes chat row (owner only)
  • updateChat — updates chat row and returns updated model
  • updateParticipantRole — updates role in chat_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:

  1. Fetches from user_blocks joined with profiles
  2. Renders each blocked user with an “Sblocca” button
  3. Unblock is optimistic — removes from local list immediately on success
  4. Falls back to empty state if the table doesn’t exist yet

DB Migrations

FileDescription
20260318000004_message_reactions_rpc.sqltoggle_message_reaction(message_id, user_id, emoji) — atomic JSONB toggle
20260318000005_user_blocks.sqluser_blocks(blocker_id, blocked_id) with RLS