Skip to content

Commit 5573e5e

Browse files
chore(runway): cherry-pick fix: cp-7.65.0 Remove speed-up and cancel buttons temporarily (#25925)
- fix: cp-7.65.0 Remove speed-up and cancel buttons temporarily (#25859) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR aims to remove speed up and cancel buttons from transaction activity temporarily. We will introduce as part of redesign here: https://github.com/MetaMask/MetaMask-planning/issues/6569 ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: #25781 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I've included tests if applicable - [X] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > UI-only removal of existing actions; risk is mainly a temporary loss of user functionality with minimal chance of breaking unrelated transaction rendering. > > **Overview** > Removes the **Speed up** and **Cancel** transaction action buttons from the activity list rows and from the transaction details modal (`TransactionElement` and `TransactionDetails`). > > Cleans up related wiring by dropping the smart-transaction gating selector/props and deleting the associated UI handlers/tests (including the `TransactionDetails` button rendering test and unused callbacks in `TransactionDetailsSheet`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 78845da. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> [fb14049](fb14049) Co-authored-by: OGPoyraz <omergoktugpoyraz@gmail.com>
1 parent 5654abb commit 5573e5e

4 files changed

Lines changed: 2 additions & 168 deletions

File tree

app/components/UI/TransactionElement/TransactionDetails/index.js

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import Logger from '../../../../util/Logger';
1818
import EthereumAddress from '../../EthereumAddress';
1919
import TransactionSummary from '../../../Views/TransactionSummary';
2020
import { toDateFormat } from '../../../../util/date';
21-
import StyledButton from '../../StyledButton';
2221
import StatusText from '../../../Base/StatusText';
2322
import Text, {
2423
TextColor,
@@ -43,7 +42,6 @@ import { selectTokensByChainIdAndAddress } from '../../../../selectors/tokensCon
4342
import { selectContractExchangeRatesByChainId } from '../../../../selectors/tokenRatesController';
4443
import { selectSelectedInternalAccountFormattedAddress } from '../../../../selectors/accountsController';
4544
import { regex } from '../../../../../app/util/regex';
46-
import { selectShouldUseSmartTransaction } from '../../../../selectors/smartTransactionsController';
4745
import {
4846
selectPrimaryCurrency,
4947
selectAvatarAccountType,
@@ -152,8 +150,6 @@ class TransactionDetails extends PureComponent {
152150
/**
153151
* A string representing the network name
154152
*/
155-
showSpeedUpModal: PropTypes.func,
156-
showCancelModal: PropTypes.func,
157153
selectedAddress: PropTypes.string,
158154
transactions: PropTypes.array,
159155
ticker: PropTypes.string,
@@ -164,11 +160,6 @@ class TransactionDetails extends PureComponent {
164160
swapsTransactions: PropTypes.object,
165161
swapsTokens: PropTypes.array,
166162
primaryCurrency: PropTypes.string,
167-
168-
/**
169-
* Boolean that indicates if smart transaction should be used
170-
*/
171-
shouldUseSmartTransaction: PropTypes.bool,
172163
/**
173164
* Avatar style to render for account icons
174165
*/
@@ -177,7 +168,6 @@ class TransactionDetails extends PureComponent {
177168

178169
state = {
179170
rpcBlockExplorer: undefined,
180-
renderTxActions: true,
181171
updatedTransactionDetails: undefined,
182172
};
183173

@@ -323,60 +313,10 @@ class TransactionDetails extends PureComponent {
323313
return createStyles(colors);
324314
};
325315

326-
showSpeedUpModal = () => {
327-
const { showSpeedUpModal, close } = this.props;
328-
if (close) {
329-
close();
330-
showSpeedUpModal();
331-
}
332-
};
333-
334-
showCancelModal = () => {
335-
const { showCancelModal, close } = this.props;
336-
if (close) {
337-
close();
338-
showCancelModal();
339-
}
340-
};
341-
342-
renderSpeedUpButton = () => {
343-
const styles = this.getStyles();
344-
345-
return (
346-
<StyledButton
347-
type={'normal'}
348-
containerStyle={[
349-
styles.actionContainerStyle,
350-
styles.speedupActionContainerStyle,
351-
]}
352-
style={styles.actionStyle}
353-
onPress={this.showSpeedUpModal}
354-
>
355-
{strings('transaction.speedup')}
356-
</StyledButton>
357-
);
358-
};
359-
360-
renderCancelButton = () => {
361-
const styles = this.getStyles();
362-
363-
return (
364-
<StyledButton
365-
type={'cancel'}
366-
containerStyle={styles.actionContainerStyle}
367-
style={styles.actionStyle}
368-
onPress={this.showCancelModal}
369-
>
370-
{strings('transaction.cancel')}
371-
</StyledButton>
372-
);
373-
};
374-
375316
render = () => {
376317
const {
377318
transactionObject,
378319
transactionObject: { status, time, txParams, chainId: txChainId },
379-
shouldUseSmartTransaction,
380320
} = this.props;
381321
const chainId = txChainId;
382322
const hasNestedTransactions = Boolean(
@@ -385,9 +325,6 @@ class TransactionDetails extends PureComponent {
385325
const { updatedTransactionDetails } = this.state;
386326
const styles = this.getStyles();
387327

388-
const renderTxActions =
389-
(status === 'submitted' || status === 'approved') &&
390-
!shouldUseSmartTransaction;
391328
const { rpcBlockExplorer } = this.state;
392329

393330
return updatedTransactionDetails ? (
@@ -412,13 +349,6 @@ class TransactionDetails extends PureComponent {
412349
{strings('transactions.status')}
413350
</DetailsModal.SectionTitle>
414351
<StatusText status={status} />
415-
{!!renderTxActions &&
416-
updatedTransactionDetails?.txChainId === chainId && (
417-
<View style={styles.transactionActionsContainer}>
418-
{this.renderSpeedUpButton()}
419-
{this.renderCancelButton()}
420-
</View>
421-
)}
422352
</DetailsModal.Column>
423353
<DetailsModal.Column end>
424354
<DetailsModal.SectionTitle>
@@ -567,10 +497,6 @@ const mapStateToProps = (state, ownProps) => ({
567497
primaryCurrency: selectPrimaryCurrency(state),
568498
swapsTransactions: selectSwapsTransactions(state),
569499
swapsTokens: swapsControllerTokens(state),
570-
shouldUseSmartTransaction: selectShouldUseSmartTransaction(
571-
state,
572-
ownProps.transactionObject.chainId,
573-
),
574500
avatarAccountType: selectAvatarAccountType(state),
575501
});
576502

app/components/UI/TransactionElement/TransactionDetails/index.test.tsx

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { query } from '@metamask/controller-utils';
3-
import { fireEvent, waitFor } from '@testing-library/react-native';
3+
import { fireEvent } from '@testing-library/react-native';
44
import TransactionDetails from './';
55
import { backgroundState } from '../../../../util/test/initial-root-state';
66
import { MOCK_ACCOUNTS_CONTROLLER_STATE } from '../../../../util/test/accountsControllerTestUtils';
@@ -348,37 +348,6 @@ describe('TransactionDetails', () => {
348348
});
349349
});
350350

351-
it('should render speed up and cancel buttons', async () => {
352-
const { getByText } = renderComponent({
353-
state: {
354-
...initialState,
355-
engine: {
356-
...initialState.engine,
357-
backgroundState: {
358-
...initialState.engine.backgroundState,
359-
PreferencesController: {
360-
smartTransactionsOptInStatus: false,
361-
},
362-
},
363-
},
364-
},
365-
hash: '0x3',
366-
txParams: {
367-
multiLayerL1FeeTotal: '0x1',
368-
},
369-
status: 'submitted',
370-
});
371-
372-
await waitFor(() => {
373-
const speedUpButton = getByText('Speed up');
374-
expect(speedUpButton).toBeDefined();
375-
const cancelButton = getByText('Cancel');
376-
expect(cancelButton).toBeDefined();
377-
fireEvent.press(speedUpButton);
378-
fireEvent.press(cancelButton);
379-
});
380-
});
381-
382351
it('should render `Batched transactions` tag if there are nested transactions', async () => {
383352
const { getByText } = renderComponent({
384353
state: initialState,

app/components/UI/TransactionElement/TransactionDetailsSheet/TransactionDetailsSheet.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ const TransactionDetailsSheet: React.FC = () => {
5959
sheetRef.current?.onCloseBottomSheet();
6060
}, []);
6161

62-
// Note: TransactionDetails internally calls close() before invoking these,
63-
// so we don't need to close the sheet here - it's already handled
64-
const handleSpeedUp = useCallback(() => {
65-
route.params.showSpeedUpModal();
66-
}, [route.params]);
67-
68-
const handleCancel = useCallback(() => {
69-
route.params.showCancelModal();
70-
}, [route.params]);
71-
7262
return (
7363
<BottomSheet ref={sheetRef} shouldNavigateBack>
7464
<BottomSheetHeader onClose={handleClose}>
@@ -83,8 +73,6 @@ const TransactionDetailsSheet: React.FC = () => {
8373
<TransactionDetails
8474
transactionObject={tx}
8575
transactionDetails={transactionDetails}
86-
showSpeedUpModal={handleSpeedUp}
87-
showCancelModal={handleCancel}
8876
close={handleClose}
8977
/>
9078
</BottomSheet>

app/components/UI/TransactionElement/index.js

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class TransactionElement extends PureComponent {
498498
isQRHardwareAccount,
499499
isLedgerAccount,
500500
i,
501-
tx: { status, isSmartTransaction, chainId, type },
501+
tx: { status, chainId, type },
502502
tx,
503503
bridgeTxHistoryData: { bridgeTxHistoryItem, isBridgeComplete },
504504
} = this.props;
@@ -513,14 +513,6 @@ class TransactionElement extends PureComponent {
513513
bridgeTxHistoryItem.status.status,
514514
)
515515
: status;
516-
517-
const renderNormalActions =
518-
(transactionStatus === 'submitted' ||
519-
(transactionStatus === 'approved' &&
520-
!isQRHardwareAccount &&
521-
!isLedgerAccount)) &&
522-
!isSmartTransaction &&
523-
!isBridgeTransaction;
524516
const renderUnsignedQRActions =
525517
transactionStatus === 'approved' && isQRHardwareAccount;
526518
const renderLedgerActions =
@@ -571,12 +563,6 @@ class TransactionElement extends PureComponent {
571563
</ListItem.Amounts>
572564
)}
573565
</ListItem.Content>
574-
{renderNormalActions && (
575-
<ListItem.Actions>
576-
{this.renderSpeedUpButton()}
577-
{this.renderCancelButton()}
578-
</ListItem.Actions>
579-
)}
580566
{renderUnsignedQRActions && (
581567
<ListItem.Actions>
582568
{this.renderQRSignButton()}
@@ -590,22 +576,6 @@ class TransactionElement extends PureComponent {
590576
);
591577
};
592578

593-
renderCancelButton = () => {
594-
const { colors, typography } = this.context || mockTheme;
595-
const styles = createStyles(colors, typography);
596-
597-
return (
598-
<StyledButton
599-
type={'cancel'}
600-
containerStyle={styles.actionContainerStyle}
601-
style={styles.actionStyle}
602-
onPress={this.showCancelModal}
603-
>
604-
{strings('transaction.cancel')}
605-
</StyledButton>
606-
);
607-
};
608-
609579
parseGas = () => {
610580
const { tx } = this.props;
611581

@@ -661,25 +631,6 @@ class TransactionElement extends PureComponent {
661631
this.mounted && this.props.cancelUnsignedQRTransaction(this.props.tx);
662632
};
663633

664-
renderSpeedUpButton = () => {
665-
const { colors, typography } = this.context || mockTheme;
666-
const styles = createStyles(colors, typography);
667-
668-
return (
669-
<StyledButton
670-
type={'normal'}
671-
containerStyle={[
672-
styles.actionContainerStyle,
673-
styles.speedupActionContainerStyle,
674-
]}
675-
style={styles.actionStyle}
676-
onPress={this.showSpeedUpModal}
677-
>
678-
{strings('transaction.speedup')}
679-
</StyledButton>
680-
);
681-
};
682-
683634
renderQRSignButton = () => {
684635
const { colors, typography } = this.context || mockTheme;
685636
const styles = createStyles(colors, typography);

0 commit comments

Comments
 (0)