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}`}
</Typography>
)}
<Button disabled={isFetchingGroupSecretKey} onClick={setIsForceShowCreationKeyPopup} variant="contained">
<Button disabled={isFetchingGroupSecretKey} onClick={()=> setIsForceShowCreationKeyPopup(true)} variant="contained">
Publish group secret key
</Button>
<Spacer height="20px" />

View File

@ -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
<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>
</Box>
): (
): isForceShowCreationKeyPopup ? null : (
<Box>
<Typography>The group member list has changed. Please re-encrypt the secret key.</Typography>
</Box>

View File

@ -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 (
<div
@ -1842,6 +1847,7 @@ export const Group = ({
setFirstSecretKeyInCreation(false);
setGroupSection("chat");
setIsOpenDrawer(false);
setIsForceShowCreationKeyPopup(false)
setTimeout(() => {
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) && (
<CreateCommonSecret
isForceShowCreationKeyPopup={isForceShowCreationKeyPopup}
setHideCommonKeyPopup={setHideCommonKeyPopup}
groupId={selectedGroup?.groupId}
secretKey={secretKey}