From 860eaae4c89a4b8bc0a9e8eecb3f7b7ab50e9fef Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Sat, 25 Jan 2025 03:44:43 +0100 Subject: [PATCH 1/2] fix: approvals triggering for personal secrets --- .../components/SecretListView/SecretListView.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx index 706f3f53e..83591ef1c 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx @@ -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); From 08a0550cd740cc433660517273fac56f7fbea34b Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Fri, 24 Jan 2025 19:21:33 -0800 Subject: [PATCH 2/2] fix: correct dependency arra --- .../components/SecretListView/SecretListView.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx index 83591ef1c..3a89a58ab 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx @@ -288,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"), []);