From 1488ee8f85671de96c70347c1b17fb9c4556bd88 Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Sat, 17 Oct 2026 15:29:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(flutter):=20=E9=80=8F=E4=BC=A0=E4=B8=BE?= =?UTF-8?q?=E6=8A=A5=E6=9C=AC=E4=BA=BA=E8=AF=84=E8=AE=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/player/widgets/comment_tile.dart | 9 +++--- test/comment/drama_comments_sheet_test.dart | 36 +++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/lib/pages/player/widgets/comment_tile.dart b/lib/pages/player/widgets/comment_tile.dart index f453682..5e3145d 100644 --- a/lib/pages/player/widgets/comment_tile.dart +++ b/lib/pages/player/widgets/comment_tile.dart @@ -90,12 +90,11 @@ class CommentTile extends StatelessWidget { PopupMenuItem( value: _deleteAction, child: Text(l10n.deleteComment), - ) - else - PopupMenuItem( - value: _reportAction, - child: Text(l10n.reportComment), ), + PopupMenuItem( + value: _reportAction, + child: Text(l10n.reportComment), + ), ], ), ], diff --git a/test/comment/drama_comments_sheet_test.dart b/test/comment/drama_comments_sheet_test.dart index ad2a65b..f876764 100644 --- a/test/comment/drama_comments_sheet_test.dart +++ b/test/comment/drama_comments_sheet_test.dart @@ -273,6 +273,42 @@ void main() { expect(find.text('Sign in to continue'), findsOneWidget); expect(interactions.reports, isEmpty); }); + + testWidgets('should_show_backend_message_when_reporting_own_comment', ( + tester, + ) async { + final repository = FakeCommentRepository( + pages: [ + CommentPage( + comments: [ + commentFixture( + id: '10', + content: 'My comment', + mine: true, + ), + ], + ), + ], + ); + final interactions = FakeInteractionRepository() + ..reportError = const ApiException(400, '不能举报自己发布的内容'); + + await _pumpSheet( + tester, + repository: repository, + interactions: interactions, + ); + await tester.tap(find.byKey(const Key('comment-menu-10'))); + await tester.pumpAndSettle(); + expect(find.text('Delete comment'), findsOneWidget); + expect(find.text('Report comment'), findsOneWidget); + await tester.tap(find.text('Report comment')); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('report-submit'))); + await tester.pumpAndSettle(); + + expect(find.text('不能举报自己发布的内容'), findsOneWidget); + }); } Future _pumpSheet(