fix issue with re-encrypt notification

This commit is contained in:
PhilReact 2024-09-23 15:29:22 +03:00
parent 2c17ddc35d
commit 5bfedd119e
3 changed files with 9 additions and 8 deletions

View File

@ -241,7 +241,8 @@ export const ChatGroup = ({selectedGroup, secretKey, setSecretKey, getSecretKey,
useEffect(()=> { useEffect(()=> {
const notifications = messages.filter((message)=> message?.text?.type === 'notification') const notifications = messages.filter((message)=> message?.decryptedData
?.type === 'notification')
if(notifications.length === 0) return if(notifications.length === 0) return
const latestNotification = notifications.reduce((latest, current) => { const latestNotification = notifications.reduce((latest, current) => {
return current.timestamp > latest.timestamp ? current : latest; return current.timestamp > latest.timestamp ? current : latest;

View File

@ -159,8 +159,8 @@ export const MessageItem = ({
])} ])}
/> />
)} )}
{reply?.text?.type === "notification" ? ( {reply?.decryptedData?.type === "notification" ? (
<MessageDisplay htmlContent={reply.text?.data?.message} /> <MessageDisplay htmlContent={reply.decryptedData?.data?.message} />
) : ( ) : (
<MessageDisplay isReply htmlContent={reply.text} /> <MessageDisplay isReply htmlContent={reply.text} />
)} )}
@ -176,8 +176,8 @@ export const MessageItem = ({
])} ])}
/> />
)} )}
{message?.text?.type === "notification" ? ( {message?.decryptedData?.type === "notification" ? (
<MessageDisplay htmlContent={message.text?.data?.message} /> <MessageDisplay htmlContent={message.decryptedData?.data?.message} />
) : ( ) : (
<MessageDisplay htmlContent={message.text} /> <MessageDisplay htmlContent={message.text} />
)} )}
@ -265,8 +265,8 @@ export const ReplyPreview = ({message})=> {
])} ])}
/> />
)} )}
{message?.text?.type === "notification" ? ( {message?.decryptedData?.type === "notification" ? (
<MessageDisplay htmlContent={message.text?.data?.message} /> <MessageDisplay htmlContent={message.decryptedData?.data?.message} />
) : ( ) : (
<MessageDisplay isReply htmlContent={message.text} /> <MessageDisplay isReply htmlContent={message.text} />
)} )}

View File

@ -1039,7 +1039,7 @@ export const Group = ({
return false; return false;
const isDiffMemberNumber = const isDiffMemberNumber =
memberCountFromSecretKeyData !== members?.memberCount && memberCountFromSecretKeyData !== members?.memberCount &&
newEncryptionNotification?.text?.data?.numberOfMembers !== newEncryptionNotification?.decryptedData?.data?.numberOfMembers !==
members?.memberCount; members?.memberCount;
if (isDiffMemberNumber) return true; if (isDiffMemberNumber) return true;