diff --git a/CHANGELOG.md b/CHANGELOG.md index cfaf5a476960..193e90547117 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -181,6 +181,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - fix: increase gas limit validation threshold ([#29264](https://github.com/MetaMask/metamask-extension/pull/29264)) - test: [POM] Privacy Mode spec ([#29263](https://github.com/MetaMask/metamask-extension/pull/29263)) +## [12.10.2] +### Fixed +- Updated permissions header to be consistent (#29880) ([#29880](https://github.com/MetaMask/metamask-extension/pull/29880)) +- Fixed Route to bridge page from swaps ([#29883](https://github.com/MetaMask/metamask-extension/pull/29883)) +- Re-added missing smart transaction status confirmation (#29860) ([#29860](https://github.com/MetaMask/metamask-extension/pull/29860)) + + ## [12.10.1] ### Changed - Stop publishing MMI builds to the release page ([#29732](https://github.com/MetaMask/metamask-extension/pull/29732)) @@ -5733,7 +5740,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c [Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.11.0...HEAD -[12.11.0]: https://github.com/MetaMask/metamask-extension/compare/v12.10.1...v12.11.0 +[12.11.0]: https://github.com/MetaMask/metamask-extension/compare/v12.10.2...v12.11.0 +[12.10.2]: https://github.com/MetaMask/metamask-extension/compare/v12.10.1...v12.10.2 [12.10.1]: https://github.com/MetaMask/metamask-extension/compare/v12.10.0...v12.10.1 [12.10.0]: https://github.com/MetaMask/metamask-extension/compare/v12.9.3...v12.10.0 [12.9.3]: https://github.com/MetaMask/metamask-extension/compare/v12.9.2...v12.9.3 diff --git a/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts b/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts index 9804e14a0e00..f832b451572f 100644 --- a/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts +++ b/ui/pages/confirmations/hooks/useConfirmationNavigation.test.ts @@ -116,6 +116,19 @@ describe('useConfirmationNavigation', () => { ); }); + it('does not navigate to template route if approval flow and pending approval', () => { + const result = renderHook(ApprovalType.Transaction, undefined, [ + {} as never, + ]); + + result.navigateToId(APPROVAL_ID_MOCK); + + expect(history.replace).toHaveBeenCalledTimes(1); + expect(history.replace).toHaveBeenCalledWith( + `${CONFIRM_TRANSACTION_ROUTE}/${APPROVAL_ID_MOCK}`, + ); + }); + it('navigates to connect route', () => { const result = renderHook(ApprovalType.WalletRequestPermissions); diff --git a/ui/pages/confirmations/hooks/useConfirmationNavigation.ts b/ui/pages/confirmations/hooks/useConfirmationNavigation.ts index 95bc1d93cd34..ef081c6497c9 100644 --- a/ui/pages/confirmations/hooks/useConfirmationNavigation.ts +++ b/ui/pages/confirmations/hooks/useConfirmationNavigation.ts @@ -76,12 +76,14 @@ export function navigateToConfirmation( hasApprovalFlows: boolean, history: ReturnType, ) { - if (hasApprovalFlows) { + const hasNoConfirmations = confirmations?.length <= 0 || !confirmationId; + + if (hasApprovalFlows && hasNoConfirmations) { history.replace(`${CONFIRMATION_V_NEXT_ROUTE}`); return; } - if (confirmations?.length <= 0 || !confirmationId) { + if (hasNoConfirmations) { return; } diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index 3daed446261a..59dd0419f503 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -315,9 +315,9 @@ export default class Home extends PureComponent { history.push(PREPARE_SWAP_ROUTE); } else if (canRedirect && haveBridgeQuotes) { history.push(CROSS_CHAIN_SWAP_ROUTE + PREPARE_SWAP_ROUTE); - } else if (pendingApprovals.length) { + } else if (pendingApprovals.length || hasApprovalFlows) { navigateToConfirmation( - pendingApprovals[0].id, + pendingApprovals?.[0]?.id, pendingApprovals, hasApprovalFlows, history, diff --git a/ui/pages/permissions-connect/permissions-connect.component.js b/ui/pages/permissions-connect/permissions-connect.component.js index 6509b79249ab..2341e1a1af6d 100644 --- a/ui/pages/permissions-connect/permissions-connect.component.js +++ b/ui/pages/permissions-connect/permissions-connect.component.js @@ -126,6 +126,9 @@ export default class PermissionConnect extends Component { this.props.permissionsRequest, ), permissionsApproved: null, + origin: this.props.origin, + targetSubjectMetadata: this.props.targetSubjectMetadata || {}, + snapsInstallPrivacyWarningShown: this.props.snapsInstallPrivacyWarningShown, }; componentDidMount() { @@ -148,6 +151,7 @@ export default class PermissionConnect extends Component { history.replace(DEFAULT_ROUTE); return; } + // if this is an incremental permission request for permitted chains, skip the account selection if ( permissionsRequest?.diff?.permissionDiffMap?.[ @@ -156,6 +160,7 @@ export default class PermissionConnect extends Component { ) { history.replace(confirmPermissionPath); } + if (history.location.pathname === connectPath && !isRequestingAccounts) { switch (requestType) { case 'wallet_installSnap': @@ -177,8 +182,17 @@ export default class PermissionConnect extends Component { } componentDidUpdate(prevProps) { - const { permissionsRequest, lastConnectedInfo, origin } = this.props; - const { redirecting } = this.state; + const { permissionsRequest, lastConnectedInfo, targetSubjectMetadata } = + this.props; + const { redirecting, origin } = this.state; + + // We cache the last known good targetSubjectMetadata since it may be null when the approval is cleared + if ( + targetSubjectMetadata?.origin && + prevProps.targetSubjectMetadata?.origin !== targetSubjectMetadata?.origin + ) { + this.setState({ targetSubjectMetadata }); + } if (!permissionsRequest && prevProps.permissionsRequest && !redirecting) { const accountsLastApprovedTime = @@ -264,7 +278,7 @@ export default class PermissionConnect extends Component { } renderTopBar(permissionsRequestId) { - const { targetSubjectMetadata } = this.props; + const { targetSubjectMetadata } = this.state; const handleCancelFromHeader = () => { this.cancelPermissionsRequest(permissionsRequestId); }; @@ -321,12 +335,14 @@ export default class PermissionConnect extends Component { rejectPendingApproval, setSnapsInstallPrivacyWarningShownStatus, approvePermissionsRequest, - snapsInstallPrivacyWarningShown, - origin, history, } = this.props; - const { selectedAccountAddresses, permissionsApproved, redirecting } = - this.state; + const { + selectedAccountAddresses, + permissionsApproved, + redirecting, + snapsInstallPrivacyWarningShown, + } = this.state; const isRequestingSnap = isSnapId(permissionsRequest?.metadata?.origin); @@ -368,7 +384,7 @@ export default class PermissionConnect extends Component { rejectPermissionsRequest={(requestId) => this.cancelPermissionsRequest(requestId) } - activeTabOrigin={origin} + activeTabOrigin={this.state.origin} request={permissionsRequest} permissionsRequestId={permissionsRequestId} approveConnection={this.approveConnection}