Skip to content

Commit

Permalink
fix: Removing warning prop from settings (MetaMask#27990)
Browse files Browse the repository at this point in the history
<!--
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**
Even though `warning` property is still used in the setting-tab and
security-tab, we are no longer using `displayWarning` to update the
error from the settings. This makes the error displayed in the tabs
irrelevant to the component. So with this PR we are removing the warning
property from settings-tab and security-tab.
We are removing the warning property from advance-tab in
MetaMask#26999
<!--
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?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27990?quickstart=1)

## **Related issues**

Related to MetaMask#25838

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**
<img width="1444" alt="Screenshot 2024-11-01 at 9 52 31 AM"
src="https://github.com/user-attachments/assets/18ffe6ef-670c-42f6-94ad-d2c0444996ec">

<img width="1376" alt="Screenshot 2024-11-01 at 9 52 07 AM"
src="https://github.com/user-attachments/assets/1767a3be-b0fe-40a7-9c6d-def6b35a5f0c">

<img width="1389" alt="Screenshot 2024-11-01 at 9 52 19 AM"
src="https://github.com/user-attachments/assets/0a3cae3f-9215-4d76-8530-debb76a01f54">

<!-- [screenshots/recordings] -->

### **After**
<img width="1409" alt="Screenshot 2024-11-01 at 10 20 47 AM"
src="https://github.com/user-attachments/assets/2e27563d-baa2-4d33-a30b-5d16bf292bf5">

<img width="1316" alt="Screenshot 2024-11-01 at 10 21 23 AM"
src="https://github.com/user-attachments/assets/3618ce07-da3a-48de-a0d4-e0768a2aaa85">
<img width="1542" alt="Screenshot 2024-11-01 at 10 21 14 AM"
src="https://github.com/user-attachments/assets/866730ae-d6dd-4684-ba35-dd2cb34e2b7c">

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.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.

Co-authored-by: Harika <153644847+hjetpoluru@users.noreply.github.com>
Co-authored-by: Danica Shen <zhaodanica@gmail.com>
  • Loading branch information
3 people authored Nov 1, 2024
1 parent 59044a4 commit a94de6a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ exports[`Security Tab should match snapshot 1`] = `
</label>
</div>
</div>
<div
class="settings-tab__error"
>
warning
</div>
<span
class="settings-page__security-tab-sub-header__bold"
>
Expand Down
4 changes: 0 additions & 4 deletions ui/pages/settings/security-tab/security-tab.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default class SecurityTab extends PureComponent {
};

static propTypes = {
warning: PropTypes.string,
history: PropTypes.object,
openSeaEnabled: PropTypes.bool,
setOpenSeaEnabled: PropTypes.func,
Expand Down Expand Up @@ -1131,7 +1130,6 @@ export default class SecurityTab extends PureComponent {

render() {
const {
warning,
petnamesEnabled,
dataCollectionForMarketing,
setDataCollectionForMarketing,
Expand All @@ -1144,8 +1142,6 @@ export default class SecurityTab extends PureComponent {
{showDataCollectionDisclaimer
? this.renderDataCollectionWarning()
: null}

{warning && <div className="settings-tab__error">{warning}</div>}
<span className="settings-page__security-tab-sub-header__bold">
{this.context.t('security')}
</span>
Expand Down
6 changes: 1 addition & 5 deletions ui/pages/settings/security-tab/security-tab.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ import { openBasicFunctionalityModal } from '../../../ducks/app/app';
import SecurityTab from './security-tab.component';

const mapStateToProps = (state) => {
const {
appState: { warning },
metamask,
} = state;
const { metamask } = state;

const petnamesEnabled = getPetnamesEnabled(state);

Expand All @@ -60,7 +57,6 @@ const mapStateToProps = (state) => {
const networkConfigurations = getNetworkConfigurationsByChainId(state);

return {
warning,
incomingTransactionsPreferences,
networkConfigurations,
participateInMetaMetrics,
Expand Down
2 changes: 0 additions & 2 deletions ui/pages/settings/security-tab/security-tab.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jest.mock('../../../ducks/app/app.ts', () => {
});

describe('Security Tab', () => {
mockState.appState.warning = 'warning'; // This tests an otherwise untested render branch

const mockStore = configureMockStore([thunk])(mockState);

function renderWithProviders(ui, store) {
Expand Down
4 changes: 0 additions & 4 deletions ui/pages/settings/settings-tab/settings-tab.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export default class SettingsTab extends PureComponent {
static propTypes = {
setUseBlockie: PropTypes.func,
setCurrentCurrency: PropTypes.func,
warning: PropTypes.string,
updateCurrentLocale: PropTypes.func,
currentLocale: PropTypes.string,
useBlockie: PropTypes.bool,
Expand Down Expand Up @@ -429,11 +428,8 @@ export default class SettingsTab extends PureComponent {
}

render() {
const { warning } = this.props;

return (
<div className="settings-page__body">
{warning ? <div className="settings-tab__error">{warning}</div> : null}
{this.renderCurrentConversion()}
{this.renderShowNativeTokenAsMainBalance()}
{this.renderCurrentLocale()}
Expand Down
6 changes: 1 addition & 5 deletions ui/pages/settings/settings-tab/settings-tab.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import { getProviderConfig } from '../../../ducks/metamask/metamask';
import SettingsTab from './settings-tab.component';

const mapStateToProps = (state) => {
const {
appState: { warning },
metamask,
} = state;
const { metamask } = state;
const { currentCurrency, useBlockie, currentLocale } = metamask;
const { ticker: nativeCurrency } = getProviderConfig(state);
const { address: selectedAddress } = getSelectedInternalAccount(state);
Expand All @@ -31,7 +28,6 @@ const mapStateToProps = (state) => {
const tokenList = getTokenList(state);

return {
warning,
currentLocale,
currentCurrency,
nativeCurrency,
Expand Down

0 comments on commit a94de6a

Please sign in to comment.