From d8de4dc87944d435244f1f6929d477e17558a303 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Tue, 17 Dec 2024 19:18:54 +0200 Subject: [PATCH] fix popup key --- src/components/Chat/AdminSpaceInner.tsx | 2 +- src/components/Chat/CreateCommonSecret.tsx | 4 ++-- src/components/Group/Group.tsx | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/Chat/AdminSpaceInner.tsx b/src/components/Chat/AdminSpaceInner.tsx index 65852b6..381302d 100644 --- a/src/components/Chat/AdminSpaceInner.tsx +++ b/src/components/Chat/AdminSpaceInner.tsx @@ -199,7 +199,7 @@ export const AdminSpaceInner = ({ {` by ${groupSecretKeyPublishDetails?.name}`} )} - diff --git a/src/components/Chat/CreateCommonSecret.tsx b/src/components/Chat/CreateCommonSecret.tsx index 468b35f..e729386 100644 --- a/src/components/Chat/CreateCommonSecret.tsx +++ b/src/components/Chat/CreateCommonSecret.tsx @@ -8,7 +8,7 @@ import { decryptResource, getGroupAdmins, validateSecretKey } from '../Group/Gro import { base64ToUint8Array } from '../../qdn/encryption/group-encryption'; import { uint8ArrayToObject } from '../../backgroundFunctions/encryption'; -export const CreateCommonSecret = ({groupId, secretKey, isOwner, myAddress, secretKeyDetails, userInfo, noSecretKey, setHideCommonKeyPopup, setIsForceShowCreationKeyPopup}) => { +export const CreateCommonSecret = ({groupId, secretKey, isOwner, myAddress, secretKeyDetails, userInfo, noSecretKey, setHideCommonKeyPopup, setIsForceShowCreationKeyPopup, isForceShowCreationKeyPopup}) => { const { show, setTxList } = useContext(MyContext); const [openSnack, setOpenSnack] = React.useState(false); @@ -164,7 +164,7 @@ export const CreateCommonSecret = ({groupId, secretKey, isOwner, myAddress, sec The latest group secret key was published by a non-owner. As the owner of the group please re-encrypt the key as a safeguard - ): ( + ): isForceShowCreationKeyPopup ? null : ( The group member list has changed. Please re-encrypt the secret key. diff --git a/src/components/Group/Group.tsx b/src/components/Group/Group.tsx index dab3254..f97292b 100644 --- a/src/components/Group/Group.tsx +++ b/src/components/Group/Group.tsx @@ -1167,6 +1167,7 @@ export const Group = ({ setSecretKeyDetails(null); setNewEncryptionNotification(null); setMemberCountFromSecretKeyData(null); + setIsForceShowCreationKeyPopup(false) setSelectedGroup(null); setSelectedDirect(null); setGroups([]); @@ -1296,6 +1297,7 @@ export const Group = ({ setAdminsWithNames([]); setMembers([]); setMemberCountFromSecretKeyData(null); + setIsForceShowCreationKeyPopup(false) setTriedToFetchSecretKey(false); setFirstSecretKeyInCreation(false); setGroupSection("chat"); @@ -1349,6 +1351,7 @@ export const Group = ({ setAdminsWithNames([]); setMembers([]); setMemberCountFromSecretKeyData(null); + setIsForceShowCreationKeyPopup(false) setTriedToFetchSecretKey(false); setFirstSecretKeyInCreation(false); setGroupSection("announcement"); @@ -1408,6 +1411,7 @@ export const Group = ({ setAdminsWithNames([]); setMembers([]); setMemberCountFromSecretKeyData(null); + setIsForceShowCreationKeyPopup(false) setTriedToFetchSecretKey(false); setFirstSecretKeyInCreation(false); setGroupSection("forum"); @@ -1512,6 +1516,7 @@ export const Group = ({ }; + const renderDirects = () => { return (
{ setSelectedGroup(group); @@ -2377,12 +2383,13 @@ export const Group = ({ zIndex: 100, }} > - {(isPrivate && admins.includes(myAddress) && + {((isPrivate && admins.includes(myAddress) && shouldReEncrypt && triedToFetchSecretKey && !firstSecretKeyInCreation && - !hideCommonKeyPopup) || isForceShowCreationKeyPopup && ( + !hideCommonKeyPopup) || isForceShowCreationKeyPopup) && (