From 5bfedd119e95db5cb5560687e7e3b228853cbca6 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Mon, 23 Sep 2024 15:29:22 +0300 Subject: [PATCH] fix issue with re-encrypt notification --- src/components/Chat/ChatGroup.tsx | 3 ++- src/components/Chat/MessageItem.tsx | 12 ++++++------ src/components/Group/Group.tsx | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/Chat/ChatGroup.tsx b/src/components/Chat/ChatGroup.tsx index 44446cf..a8dff49 100644 --- a/src/components/Chat/ChatGroup.tsx +++ b/src/components/Chat/ChatGroup.tsx @@ -241,7 +241,8 @@ export const ChatGroup = ({selectedGroup, secretKey, setSecretKey, getSecretKey, useEffect(()=> { - const notifications = messages.filter((message)=> message?.text?.type === 'notification') + const notifications = messages.filter((message)=> message?.decryptedData + ?.type === 'notification') if(notifications.length === 0) return const latestNotification = notifications.reduce((latest, current) => { return current.timestamp > latest.timestamp ? current : latest; diff --git a/src/components/Chat/MessageItem.tsx b/src/components/Chat/MessageItem.tsx index 7df771c..bfaf5cc 100644 --- a/src/components/Chat/MessageItem.tsx +++ b/src/components/Chat/MessageItem.tsx @@ -159,8 +159,8 @@ export const MessageItem = ({ ])} /> )} - {reply?.text?.type === "notification" ? ( - + {reply?.decryptedData?.type === "notification" ? ( + ) : ( )} @@ -176,8 +176,8 @@ export const MessageItem = ({ ])} /> )} - {message?.text?.type === "notification" ? ( - + {message?.decryptedData?.type === "notification" ? ( + ) : ( )} @@ -265,8 +265,8 @@ export const ReplyPreview = ({message})=> { ])} /> )} - {message?.text?.type === "notification" ? ( - + {message?.decryptedData?.type === "notification" ? ( + ) : ( )} diff --git a/src/components/Group/Group.tsx b/src/components/Group/Group.tsx index 814fe86..338b0e8 100644 --- a/src/components/Group/Group.tsx +++ b/src/components/Group/Group.tsx @@ -1039,7 +1039,7 @@ export const Group = ({ return false; const isDiffMemberNumber = memberCountFromSecretKeyData !== members?.memberCount && - newEncryptionNotification?.text?.data?.numberOfMembers !== + newEncryptionNotification?.decryptedData?.data?.numberOfMembers !== members?.memberCount; if (isDiffMemberNumber) return true;