From 121b6809f85308773ae381da7f5c8c109fd1e4fd Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Fri, 4 Nov 2022 12:50:20 +0100 Subject: [PATCH] [FLASK] Fix some issues with installing snaps that request eth_accounts(#16365) --- .../permissions-connect.component.js | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/ui/pages/permissions-connect/permissions-connect.component.js b/ui/pages/permissions-connect/permissions-connect.component.js index 93306a76f..0df11a90e 100644 --- a/ui/pages/permissions-connect/permissions-connect.component.js +++ b/ui/pages/permissions-connect/permissions-connect.component.js @@ -164,11 +164,33 @@ export default class PermissionConnect extends Component { } selectAccounts = (addresses) => { + const { + confirmPermissionPath, + ///: BEGIN:ONLY_INCLUDE_IN(flask) + snapInstallPath, + snapUpdatePath, + isSnap, + permissionsRequest, + ///: END:ONLY_INCLUDE_IN + } = this.props; this.setState( { selectedAccountAddresses: addresses, }, - () => this.props.history.push(this.props.confirmPermissionPath), + ///: BEGIN:ONLY_INCLUDE_IN(main,beta) + () => this.props.history.push(confirmPermissionPath), + ///: END:ONLY_INCLUDE_IN + ///: BEGIN:ONLY_INCLUDE_IN(flask) + () => + this.props.history.push( + // eslint-disable-next-line no-nested-ternary + isSnap + ? permissionsRequest.newPermissions + ? snapUpdatePath + : snapInstallPath + : confirmPermissionPath, + ), + ///: END:ONLY_INCLUDE_IN ); }; @@ -315,7 +337,7 @@ export default class PermissionConnect extends Component { approveSnapInstall={(requestId) => { approvePendingApproval(requestId, { ...permissionsRequest, - approvedAccounts: selectedAccountAddresses, + approvedAccounts: [...selectedAccountAddresses], }); this.redirect(true); }} @@ -345,7 +367,7 @@ export default class PermissionConnect extends Component { approveSnapUpdate={(requestId) => { approvePendingApproval(requestId, { ...permissionsRequest, - approvedAccounts: selectedAccountAddresses, + approvedAccounts: [...selectedAccountAddresses], }); this.redirect(true); }}