diff --git a/lib/widgets/post/post_comment_list.dart b/lib/widgets/post/post_comment_list.dart index 9e7324a..4e7e23d 100644 --- a/lib/widgets/post/post_comment_list.dart +++ b/lib/widgets/post/post_comment_list.dart @@ -103,7 +103,7 @@ class PostCommentSliverListState extends State { final sn = context.read(); await sn.client .put('/cgi/co/questions/${widget.parentPost.id}/answer', data: { - 'publisher': answer.publisherId, + 'publisher': widget.parentPost.publisherId, 'answer_id': answer.id, }); if (!mounted) return; diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 9221c59..99a5785 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -279,6 +279,8 @@ class _PostItemState extends State { final ua = context.read(); final isAuthor = ua.isAuthorized && widget.data.publisher.accountId == ua.user?.id; + final isParentAuthor = ua.isAuthorized && + widget.data.replyTo?.publisher.accountId == ua.user?.id; final displayableAttachments = widget.data.preload?.attachments ?.where((ele) => @@ -333,6 +335,7 @@ class _PostItemState extends State { _PostActionPopup( data: widget.data, isAuthor: isAuthor, + isParentAuthor: isParentAuthor, onShare: () => _doShare(context), onShareImage: () => _doShareViaPicture(context), onSelectAnswer: widget.onSelectAnswer, @@ -577,6 +580,7 @@ class _PostItemState extends State { _PostActionPopup( data: widget.data, isAuthor: isAuthor, + isParentAuthor: isParentAuthor, onShare: () => _doShare(context), onShareImage: () => _doShareViaPicture(context), onSelectAnswer: widget.onSelectAnswer, @@ -1317,6 +1321,7 @@ class _PostAvatar extends StatelessWidget { class _PostActionPopup extends StatelessWidget { final SnPost data; final bool isAuthor; + final bool isParentAuthor; final Function onDeleted; final Function() onShare, onShareImage; final Function()? onSelectAnswer; @@ -1324,6 +1329,7 @@ class _PostActionPopup extends StatelessWidget { const _PostActionPopup({ required this.data, required this.isAuthor, + required this.isParentAuthor, required this.onDeleted, required this.onShare, required this.onShareImage, @@ -1397,7 +1403,7 @@ class _PostActionPopup extends StatelessWidget { }, ), if (onTranslate != null) PopupMenuDivider(), - if (isAuthor && onSelectAnswer != null) + if (isParentAuthor && onSelectAnswer != null) PopupMenuItem( child: Row( children: [ @@ -1410,7 +1416,7 @@ class _PostActionPopup extends StatelessWidget { onSelectAnswer?.call(); }, ), - if (isAuthor && onSelectAnswer != null) PopupMenuDivider(), + if (isParentAuthor && onSelectAnswer != null) PopupMenuDivider(), if (isAuthor) PopupMenuItem( child: Row(