From e91406a4c7fbd1614b6b616fcfd1a9a371f580f9 Mon Sep 17 00:00:00 2001 From: Patrick O'Sullivan Date: Wed, 27 Mar 2024 14:21:38 -0500 Subject: [PATCH] edit: fix issue with editing replies in notebooks and galleries Fixes LAND-1731 --- apps/tlon-web/src/replies/ReplyMessage.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/tlon-web/src/replies/ReplyMessage.tsx b/apps/tlon-web/src/replies/ReplyMessage.tsx index 7153e7190c..2cdb499bb4 100644 --- a/apps/tlon-web/src/replies/ReplyMessage.tsx +++ b/apps/tlon-web/src/replies/ReplyMessage.tsx @@ -41,7 +41,7 @@ import DoubleCaretRightIcon from '@/components/icons/DoubleCaretRightIcon'; import { JSONToInlines, diaryMixedToJSON } from '@/logic/tiptap'; import useLongPress from '@/logic/useLongPress'; import { useIsMobile } from '@/logic/useMedia'; -import { useIsDmOrMultiDm } from '@/logic/utils'; +import { nestToFlag, useIsDmOrMultiDm, whomIsNest } from '@/logic/utils'; import { useEditReplyMutation, useIsEdited, @@ -125,6 +125,9 @@ const ReplyMessage = React.memo< }: ReplyMessageProps, ref ) => { + // we pass `whom` as a channel flag for chat, nest for diary/heap + // because we use flags in unreads + const nest = whomIsNest(whom) ? whom : `chat/${whom}`; const [searchParms, setSearchParams] = useSearchParams(); const isEditing = searchParms.get('editReply') === reply.seal.id; const isEdited = useIsEdited(reply); @@ -285,7 +288,7 @@ const ReplyMessage = React.memo< } editReply({ - nest: `chat/${whom}`, + nest, postId: seal['parent-id'], replyId: seal.id, memo: { @@ -297,7 +300,7 @@ const ReplyMessage = React.memo< setSearchParams({}, { replace: true }); }, - [editReply, whom, seal, memo, setSearchParams] + [editReply, nest, seal, memo, setSearchParams] ); const messageEditor = useMessageEditor({