From 16d0075959869fd8f84f5aa10cbd0853cc6af025 Mon Sep 17 00:00:00 2001 From: AlexVincent525 Date: Tue, 18 Feb 2020 12:17:13 +0800 Subject: [PATCH] :bug: Fix user cannot delete their comment. --- lib/controller/comment_controller.dart | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/controller/comment_controller.dart b/lib/controller/comment_controller.dart index 76939579..7ba999de 100755 --- a/lib/controller/comment_controller.dart +++ b/lib/controller/comment_controller.dart @@ -327,18 +327,17 @@ class CommentListInPostState extends State with AutomaticKeep ConfirmationBottomSheet.show( context, children: [ - if (widget.post.uid == currentUser.uid) + if (_comments[index].fromUserUid == currentUser.uid || widget.post.uid == currentUser.uid) ConfirmationBottomSheetAction( icon: Icon(Icons.delete), text: '删除评论', onTap: () => confirmDelete(context, _comments[index]), - ) - else - ConfirmationBottomSheetAction( - icon: Icon(Icons.reply), - text: '回复评论', - onTap: () => replyTo(index), ), + ConfirmationBottomSheetAction( + icon: Icon(Icons.reply), + text: '回复评论', + onTap: () => replyTo(index), + ), ConfirmationBottomSheetAction( icon: Icon(Icons.report), text: '复制评论',