Merge pull request #3042 from Infisical/daniel/fix-approvals-for-personal-secrets

fix: approvals triggering for personal secrets
This commit is contained in:
Daniel Hougaard
2025-01-25 04:50:19 +01:00
committed by GitHub

View File

@@ -180,10 +180,12 @@ export const SecretListView = ({
try {
// personal secret change
let personalAction = false;
if (overrideAction === "deleted") {
await handleSecretOperation("delete", SecretType.Personal, oldKey, {
secretId: orgSecret.idOverride
});
personalAction = true;
} else if (overrideAction && idOverride) {
await handleSecretOperation("update", SecretType.Personal, oldKey, {
value: valueOverride,
@@ -191,14 +193,16 @@ export const SecretListView = ({
secretId: orgSecret.idOverride,
skipMultilineEncoding: modSecret.skipMultilineEncoding
});
personalAction = true;
} else if (overrideAction) {
await handleSecretOperation("create", SecretType.Personal, oldKey, {
value: valueOverride
});
personalAction = true;
}
// shared secret change
if (!isSharedSecUnchanged) {
if (!isSharedSecUnchanged && !personalAction) {
await handleSecretOperation("update", SecretType.Shared, oldKey, {
value,
tags: tagIds,
@@ -232,10 +236,11 @@ export const SecretListView = ({
});
handlePopUpClose("secretDetail");
createNotification({
type: isProtectedBranch ? "info" : "success",
text: isProtectedBranch
? "Requested changes have been sent for review"
: "Successfully saved secrets"
type: isProtectedBranch && !personalAction ? "info" : "success",
text:
isProtectedBranch && !personalAction
? "Requested changes have been sent for review"
: "Successfully saved secrets"
});
} catch (error) {
console.log(error);
@@ -283,7 +288,12 @@ export const SecretListView = ({
text: "Failed to delete secret"
});
}
}, [(popUp.deleteSecret?.data as SecretV3RawSanitized)?.key, environment, secretPath]);
}, [
(popUp.deleteSecret?.data as SecretV3RawSanitized)?.key,
environment,
secretPath,
isProtectedBranch
]);
// for optimization on minimise re-rendering of secret items
const onCreateTag = useCallback(() => handlePopUpOpen("createTag"), []);