fix key popup

This commit is contained in:
PhilReact 2024-12-17 19:17:37 +02:00
parent bd19a0b6d2
commit 7b69957ea8
2 changed files with 11 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import { decryptResource, getGroupAdmins, validateSecretKey } from '../Group/Gro
import { base64ToUint8Array } from '../../qdn/encryption/group-encryption'; import { base64ToUint8Array } from '../../qdn/encryption/group-encryption';
import { uint8ArrayToObject } from '../../backgroundFunctions/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 { show, setTxList } = useContext(MyContext);
const [openSnack, setOpenSnack] = React.useState(false); const [openSnack, setOpenSnack] = React.useState(false);
@ -164,7 +164,7 @@ export const CreateCommonSecret = ({groupId, secretKey, isOwner, myAddress, sec
<Box> <Box>
<Typography>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</Typography> <Typography>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</Typography>
</Box> </Box>
): ( ) : isForceShowCreationKeyPopup ? null : (
<Box> <Box>
<Typography>The group member list has changed. Please re-encrypt the secret key.</Typography> <Typography>The group member list has changed. Please re-encrypt the secret key.</Typography>
</Box> </Box>

View File

@ -1322,6 +1322,7 @@ export const Group = ({
setSecretKeyDetails(null); setSecretKeyDetails(null);
setNewEncryptionNotification(null); setNewEncryptionNotification(null);
setMemberCountFromSecretKeyData(null); setMemberCountFromSecretKeyData(null);
setIsForceShowCreationKeyPopup(false)
setSelectedGroup(null); setSelectedGroup(null);
setSelectedDirect(null); setSelectedDirect(null);
setGroups([]); setGroups([]);
@ -1388,6 +1389,7 @@ export const Group = ({
setAdminsWithNames([]); setAdminsWithNames([]);
setMembers([]); setMembers([]);
setMemberCountFromSecretKeyData(null); setMemberCountFromSecretKeyData(null);
setIsForceShowCreationKeyPopup(false)
setTriedToFetchSecretKey(false); setTriedToFetchSecretKey(false);
setFirstSecretKeyInCreation(false); setFirstSecretKeyInCreation(false);
setIsOpenSideViewDirects(false) setIsOpenSideViewDirects(false)
@ -1442,6 +1444,7 @@ export const Group = ({
setAdminsWithNames([]); setAdminsWithNames([]);
setMembers([]); setMembers([]);
setMemberCountFromSecretKeyData(null); setMemberCountFromSecretKeyData(null);
setIsForceShowCreationKeyPopup(false)
setTriedToFetchSecretKey(false); setTriedToFetchSecretKey(false);
setFirstSecretKeyInCreation(false); setFirstSecretKeyInCreation(false);
setGroupSection("chat"); setGroupSection("chat");
@ -1493,6 +1496,7 @@ export const Group = ({
setAdminsWithNames([]); setAdminsWithNames([]);
setMembers([]); setMembers([]);
setMemberCountFromSecretKeyData(null); setMemberCountFromSecretKeyData(null);
setIsForceShowCreationKeyPopup(false)
setTriedToFetchSecretKey(false); setTriedToFetchSecretKey(false);
setFirstSecretKeyInCreation(false); setFirstSecretKeyInCreation(false);
setGroupSection("announcement"); setGroupSection("announcement");
@ -1554,6 +1558,7 @@ export const Group = ({
setAdminsWithNames([]); setAdminsWithNames([]);
setMembers([]); setMembers([]);
setMemberCountFromSecretKeyData(null); setMemberCountFromSecretKeyData(null);
setIsForceShowCreationKeyPopup(false)
setTriedToFetchSecretKey(false); setTriedToFetchSecretKey(false);
setFirstSecretKeyInCreation(false); setFirstSecretKeyInCreation(false);
setGroupSection("forum"); setGroupSection("forum");
@ -1610,6 +1615,7 @@ export const Group = ({
setAdminsWithNames([]); setAdminsWithNames([]);
setMembers([]); setMembers([]);
setMemberCountFromSecretKeyData(null); setMemberCountFromSecretKeyData(null);
setIsForceShowCreationKeyPopup(false)
setTriedToFetchSecretKey(false); setTriedToFetchSecretKey(false);
setFirstSecretKeyInCreation(false); setFirstSecretKeyInCreation(false);
setIsOpenSideViewDirects(false) setIsOpenSideViewDirects(false)
@ -2551,12 +2557,13 @@ export const Group = ({
zIndex: 100, zIndex: 100,
}} }}
> >
{(isPrivate && admins.includes(myAddress) && {((isPrivate && admins.includes(myAddress) &&
shouldReEncrypt && shouldReEncrypt &&
triedToFetchSecretKey && triedToFetchSecretKey &&
!firstSecretKeyInCreation && !firstSecretKeyInCreation &&
!hideCommonKeyPopup) || isForceShowCreationKeyPopup && ( !hideCommonKeyPopup) || isForceShowCreationKeyPopup) && (
<CreateCommonSecret <CreateCommonSecret
isForceShowCreationKeyPopup={isForceShowCreationKeyPopup}
setHideCommonKeyPopup={setHideCommonKeyPopup} setHideCommonKeyPopup={setHideCommonKeyPopup}
groupId={selectedGroup?.groupId} groupId={selectedGroup?.groupId}
secretKey={secretKey} secretKey={secretKey}