1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

[FLASK] Fix some issues with installing snaps that request eth_accounts(#16365)

This commit is contained in:
Frederik Bolding 2022-11-04 12:50:20 +01:00 committed by GitHub
parent 348262f2ea
commit 121b6809f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}}