From a997f5c8c4d653771106eca86ffe208dca0ac32b Mon Sep 17 00:00:00 2001 From: Daniel Riera Date: Wed, 7 May 2025 10:38:28 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"PM-20514=20do=20not=20allow=20users?= =?UTF-8?q?=20without=20edit=20permissions=20to=20edit=20a=20cipher?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d5a7e563c1a6968bd400dd0cb8a92c728d98cd4c. --- .../src/autofill/background/notification.background.ts | 4 +--- .../content/components/notification/confirmation/body.ts | 2 +- .../components/notification/confirmation/container.ts | 6 ++---- .../content/components/notification/confirmation/message.ts | 4 ++-- apps/browser/src/autofill/notification/bar.ts | 3 +-- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/browser/src/autofill/background/notification.background.ts b/apps/browser/src/autofill/background/notification.background.ts index 5dd15274677..c70b18c3ca8 100644 --- a/apps/browser/src/autofill/background/notification.background.ts +++ b/apps/browser/src/autofill/background/notification.background.ts @@ -737,10 +737,8 @@ export default class NotificationBackground { const cipher = await this.cipherService.encrypt(cipherView, userId); const shouldGetTasks = await this.getNotificationFlag(); + try { - if (!cipherView.edit) { - throw new Error("You do not have permission to edit this cipher."); - } const tasks = shouldGetTasks ? await this.getSecurityTasks(userId) : []; const updatedCipherTask = tasks.find((task) => task.cipherId === cipherView?.id); const cipherHasTask = !!updatedCipherTask?.id; diff --git a/apps/browser/src/autofill/content/components/notification/confirmation/body.ts b/apps/browser/src/autofill/content/components/notification/confirmation/body.ts index 5c281071818..05916ef9cbb 100644 --- a/apps/browser/src/autofill/content/components/notification/confirmation/body.ts +++ b/apps/browser/src/autofill/content/components/notification/confirmation/body.ts @@ -22,7 +22,7 @@ export type NotificationConfirmationBodyProps = { messageDetails?: string; tasksAreComplete?: boolean; theme: Theme; - handleOpenVault: (e: Event) => void; + handleOpenVault: () => void; }; export function NotificationConfirmationBody({ diff --git a/apps/browser/src/autofill/content/components/notification/confirmation/container.ts b/apps/browser/src/autofill/content/components/notification/confirmation/container.ts index 3b5b77e07a1..e031a5cda59 100644 --- a/apps/browser/src/autofill/content/components/notification/confirmation/container.ts +++ b/apps/browser/src/autofill/content/components/notification/confirmation/container.ts @@ -21,7 +21,7 @@ import { NotificationConfirmationFooter } from "./footer"; export type NotificationConfirmationContainerProps = NotificationBarIframeInitData & { handleCloseNotification: (e: Event) => void; - handleOpenVault: (e: Event) => void; + handleOpenVault: () => void; handleOpenTasks: (e: Event) => void; } & { error?: string; @@ -75,10 +75,8 @@ export function NotificationConfirmationContainer({ buttonAria, buttonText, confirmationMessage, - error, - itemName, - messageDetails, tasksAreComplete, + messageDetails, theme, handleOpenVault, })} diff --git a/apps/browser/src/autofill/content/components/notification/confirmation/message.ts b/apps/browser/src/autofill/content/components/notification/confirmation/message.ts index 53595b3d797..1d30277c33a 100644 --- a/apps/browser/src/autofill/content/components/notification/confirmation/message.ts +++ b/apps/browser/src/autofill/content/components/notification/confirmation/message.ts @@ -10,7 +10,7 @@ export type NotificationConfirmationMessageProps = { buttonText?: string; message?: string; messageDetails?: string; - handleClick: (e: Event) => void; + handleClick: () => void; theme: Theme; }; @@ -37,7 +37,7 @@ export function NotificationConfirmationMessage({ title=${buttonText} class=${notificationConfirmationButtonTextStyles(theme)} @click=${handleClick} - @keydown=${(e: KeyboardEvent) => handleButtonKeyDown(e, () => handleClick(e))} + @keydown=${(e: KeyboardEvent) => handleButtonKeyDown(e, handleClick)} aria-label=${buttonAria} tabindex="0" role="button" diff --git a/apps/browser/src/autofill/notification/bar.ts b/apps/browser/src/autofill/notification/bar.ts index 6d4367c0b7f..76b304c1513 100644 --- a/apps/browser/src/autofill/notification/bar.ts +++ b/apps/browser/src/autofill/notification/bar.ts @@ -417,8 +417,7 @@ function handleSaveCipherConfirmation(message: NotificationBarWindowMessage) { error, itemName: itemName ?? i18n.typeLogin, task, - handleOpenVault: (e: Event) => - cipherId ? openViewVaultItemPopout(cipherId) : openAddEditVaultItemPopout(e, {}), + handleOpenVault: () => cipherId && openViewVaultItemPopout(cipherId), handleOpenTasks: () => sendPlatformMessage({ command: "bgOpenAtRisksPasswords" }), }), document.body,