fix popup key

This commit is contained in:
PhilReact 2024-12-17 19:18:54 +02:00
parent 0bc3e69560
commit d8de4dc879
3 changed files with 12 additions and 5 deletions

View File

@ -199,7 +199,7 @@ export const AdminSpaceInner = ({
{` by ${groupSecretKeyPublishDetails?.name}`} {` by ${groupSecretKeyPublishDetails?.name}`}
</Typography> </Typography>
)} )}
<Button disabled={isFetchingGroupSecretKey} onClick={setIsForceShowCreationKeyPopup} variant="contained"> <Button disabled={isFetchingGroupSecretKey} onClick={()=> setIsForceShowCreationKeyPopup(true)} variant="contained">
Publish group secret key Publish group secret key
</Button> </Button>
<Spacer height="20px" /> <Spacer height="20px" />

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

@ -1167,6 +1167,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([]);
@ -1296,6 +1297,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");
@ -1349,6 +1351,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");
@ -1408,6 +1411,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");
@ -1512,6 +1516,7 @@ export const Group = ({
}; };
const renderDirects = () => { const renderDirects = () => {
return ( return (
<div <div
@ -1842,6 +1847,7 @@ export const Group = ({
setFirstSecretKeyInCreation(false); setFirstSecretKeyInCreation(false);
setGroupSection("chat"); setGroupSection("chat");
setIsOpenDrawer(false); setIsOpenDrawer(false);
setIsForceShowCreationKeyPopup(false)
setTimeout(() => { setTimeout(() => {
setSelectedGroup(group); setSelectedGroup(group);
@ -2377,12 +2383,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}