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(