From af733ecada1691d8d0e8951714c38f38bef596c3 Mon Sep 17 00:00:00 2001 From: Bretton <36870434+BrettM86@users.noreply.github.com> Date: Thu, 16 Jul 2026 07:25:38 -0700 Subject: [PATCH] fix(moderation): wire post-detail report menu to the real report dialog The detail screen's overflow "Report" item was a dead stub that showed a "Report feature coming soon!" snackbar, even though ReportDialog has long been implemented and wired into the feed card menu. Reporting from a post's detail view now opens the same dialog (with the same sign-in guard and success snackbar), and the item is hidden on the viewer's own posts for parity with the feed card. Verified end-to-end on the emulator against the local stack (g3_report_dialog Maestro flow; server receipt in admin_reports). Co-Authored-By: Claude Fable 5 --- lib/screens/home/post_detail_screen.dart | 82 ++++++++++++++++++------ 1 file changed, 64 insertions(+), 18 deletions(-) diff --git a/lib/screens/home/post_detail_screen.dart b/lib/screens/home/post_detail_screen.dart index 3de8004..712dd12 100644 --- a/lib/screens/home/post_detail_screen.dart +++ b/lib/screens/home/post_detail_screen.dart @@ -20,6 +20,8 @@ import '../../widgets/share_button.dart'; import '../../widgets/detailed_post_view.dart'; import '../../widgets/loading_error_states.dart'; import '../../widgets/post_action_bar.dart'; +import '../../widgets/report_dialog.dart'; +import '../../widgets/sign_in_dialog.dart'; import '../../widgets/status_bar_overlay.dart'; import '../compose/reply_screen.dart'; import 'focused_thread_screen.dart'; @@ -449,15 +451,7 @@ class _PostDetailScreenState extends State { } } case 'report': - // TODO: Implement report functionality - if (mounted) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Report feature coming soon!'), - behavior: SnackBarBehavior.floating, - ), - ); - } + await _handleReport(); case 'hide': // TODO: Implement hide functionality if (mounted) { @@ -471,6 +465,54 @@ class _PostDetailScreenState extends State { } } + /// Report the post via the shared report dialog (mirrors the feed card's + /// report action — regression: the menu item used to be a dead + /// "coming soon" stub while ReportDialog already existed). + Future _handleReport() async { + final authProvider = context.read(); + if (!authProvider.isAuthenticated) { + if (!mounted) { + return; + } + final shouldSignIn = await SignInDialog.show( + context, + message: 'You need to sign in to report content.', + ); + if (shouldSignIn != true && mounted) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Sign in required to report content'), + behavior: SnackBarBehavior.floating, + ), + ); + } + return; + } + + if (!mounted) { + return; + } + final messenger = ScaffoldMessenger.of(context); + + final reported = await ReportDialog.show( + context, + targetUri: widget.post.post.uri, + contentType: 'post', + ); + + if ((reported ?? false) && mounted) { + messenger.showSnackBar( + const SnackBar( + content: Text( + 'Report submitted. Thank you for helping keep our ' + 'community safe.', + ), + behavior: SnackBarBehavior.floating, + ), + ); + } + } + /// Build bottom action bar with vote, save, and comment actions Widget _buildActionBar() { return Consumer( @@ -779,16 +821,20 @@ class _PostDetailScreenState extends State { ], ), ), - const PopupMenuItem( - value: 'report', - child: Row( - children: [ - Icon(Icons.flag_outlined, size: 20), - SizedBox(width: 12), - Text('Report'), - ], + // Report is hidden on the viewer's own posts + // (parity with the feed card menu). + if (context.read().did != + widget.post.post.author.did) + const PopupMenuItem( + value: 'report', + child: Row( + children: [ + Icon(Icons.flag_outlined, size: 20), + SizedBox(width: 12), + Text('Report'), + ], + ), ), - ), const PopupMenuItem( value: 'hide', child: Row( -- 2.51.2