1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Fix #20305 - Show the network name in Delete Network modal (#20309)

* Fix #20305 - Show the network name in Delete Network modal

* Update app/_locales/en/messages.json

Co-authored-by: George Marshall <george.marshall@consensys.net>

* Add unit test

---------

Co-authored-by: George Marshall <george.marshall@consensys.net>
This commit is contained in:
David Walsh 2023-08-04 09:48:12 -05:00 committed by GitHub
parent a85a4cf97e
commit fee1606fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 37 additions and 148 deletions

View File

@ -205,9 +205,6 @@
"deleteNetwork": {
"message": "አውታረ መረብ ይሰረዝ?"
},
"deleteNetworkDescription": {
"message": "ይህን አውታረ መረብ ለመሰረዝ እንደሚፈልጉ እርግጠኛ ነዎት?"
},
"details": {
"message": "ዝርዝሮች"
},

View File

@ -218,9 +218,6 @@
"deleteNetwork": {
"message": "هل تريد حذف الشبكة؟"
},
"deleteNetworkDescription": {
"message": "هل أنت متأكد أنك تريد حذف هذه الشبكة؟"
},
"details": {
"message": "التفاصيل"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Да се изтрие ли мрежата?"
},
"deleteNetworkDescription": {
"message": "Наистина ли искате да изтриете тази мрежа?"
},
"details": {
"message": "Подробности"
},

View File

@ -211,9 +211,6 @@
"deleteNetwork": {
"message": "নেটওয়ার্ক মুছবেন?"
},
"deleteNetworkDescription": {
"message": "আপনি কি এই নেটওয়ার্কটি মোছার বিষয়ে নিশ্চিত?"
},
"details": {
"message": "বিশদ বিবরণ"
},

View File

@ -211,9 +211,6 @@
"deleteNetwork": {
"message": "Esborrar Xarxa?"
},
"deleteNetworkDescription": {
"message": "Estàs segur que vols eliminar aquesta xarxa?"
},
"details": {
"message": "Detalls"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Slet Netværk?"
},
"deleteNetworkDescription": {
"message": "Er du sikker på, at du vil slette dette netværk?"
},
"details": {
"message": "Detaljer"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Netzwerk löschen?"
},
"deleteNetworkDescription": {
"message": "Sind Sie sicher, dass Sie dieses Netzwerk löschen möchten?"
},
"deposit": {
"message": "Einzahlung"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Διαγραφή Δικτύου;"
},
"deleteNetworkDescription": {
"message": "Θέλετε σίγουρα να διαγράψετε αυτό το δίκτυο;"
},
"deposit": {
"message": "Κατάθεση"
},

View File

@ -1120,8 +1120,12 @@
"deleteNetwork": {
"message": "Delete network?"
},
"deleteNetworkDescription": {
"message": "Are you sure you want to delete this network?"
"deleteNetworkIntro": {
"message": "If you delete this network, you will need to add it again to view your assets in this network"
},
"deleteNetworkTitle": {
"message": "Delete $1 network?",
"description": "$1 represents the name of the network"
},
"deposit": {
"message": "Deposit"

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "¿Eliminar red?"
},
"deleteNetworkDescription": {
"message": "¿Está seguro de que quiere eliminar esta red?"
},
"deposit": {
"message": "Depositar"
},

View File

@ -584,9 +584,6 @@
"deleteNetwork": {
"message": "¿Eliminar red?"
},
"deleteNetworkDescription": {
"message": "¿Está seguro de que quiere eliminar esta red?"
},
"description": {
"message": "Descripción"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Võrk kustutada?"
},
"deleteNetworkDescription": {
"message": "Olete kindel, et soovite selle võrgu kustutada?"
},
"details": {
"message": "Üksikasjad"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "شبکه حذف شود؟"
},
"deleteNetworkDescription": {
"message": "آیا مطمئن هستید که این شبکه حذف شود؟"
},
"details": {
"message": "جزئیات"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Poistetaanko verkko?"
},
"deleteNetworkDescription": {
"message": "Haluatko varmasti poistaa tämän verkon?"
},
"details": {
"message": "Tiedot"
},

View File

@ -190,9 +190,6 @@
"deleteNetwork": {
"message": "I-delete ang Network?"
},
"deleteNetworkDescription": {
"message": "Sigurado ka bang gusto mong i-delete ang network na ito?"
},
"details": {
"message": "Mga Detalye"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Supprimer le réseau ?"
},
"deleteNetworkDescription": {
"message": "Souhaitez-vous vraiment supprimer ce réseau ?"
},
"deposit": {
"message": "Effectuez un dépôt"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "למחוק את הרשת?"
},
"deleteNetworkDescription": {
"message": "הנך בטוח/ה שברצונך למחוק רשת זו?"
},
"details": {
"message": "פרטים"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "नेटवर्क हटाएं?"
},
"deleteNetworkDescription": {
"message": "क्या आप वाकई इस नेटवर्क को हटाना चाहते हैं?"
},
"deposit": {
"message": "जमा करें"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Izbrisati mrežu?"
},
"deleteNetworkDescription": {
"message": "Sigurno želite izbrisati ovu mrežu?"
},
"details": {
"message": "Detalji"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Törli a hálózatot?"
},
"deleteNetworkDescription": {
"message": "Biztosan törli ezt a hálózatot?"
},
"details": {
"message": "Részletek"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Hapus jaringan?"
},
"deleteNetworkDescription": {
"message": "Anda yakin ingin menghapus jaringan ini?"
},
"deposit": {
"message": "Deposit"
},

View File

@ -719,9 +719,6 @@
"deleteNetwork": {
"message": "Cancella la rete?"
},
"deleteNetworkDescription": {
"message": "Sei sicuro di voler eliminare questa rete?"
},
"deprecatedTestNetworksLink": {
"message": "Scopri di più"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "ネットワークを削除しますか?"
},
"deleteNetworkDescription": {
"message": "このネットワークを削除しますか?"
},
"deposit": {
"message": "入金"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "ನೆಟ್‌ವರ್ಕ್ ಅಳಿಸುವುದೇ?"
},
"deleteNetworkDescription": {
"message": "ನೀವು ಈ ನೆಟ್‌ವರ್ಕ್ ಅನ್ನು ಖಚಿತವಾಗಿ ಅಳಿಸಲು ಬಯಸುತ್ತೀರಾ?"
},
"details": {
"message": "ವಿವರಗಳು"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "네트워크를 삭제할까요?"
},
"deleteNetworkDescription": {
"message": "이 네트워크를 삭제할까요?"
},
"deposit": {
"message": "예치"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Panaikinti tinklą?"
},
"deleteNetworkDescription": {
"message": "Ar tikrai norite panaikinti šį tinklą?"
},
"details": {
"message": "Išsami informacija"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Dzēst tīklu?"
},
"deleteNetworkDescription": {
"message": "Vai tiešām vēlaties dzēst šo tīklu?"
},
"details": {
"message": "Informācija"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Padamkan Rangkaian?"
},
"deleteNetworkDescription": {
"message": "Anda pasti anda ingin padamkan rangkaian ini?"
},
"details": {
"message": "Butiran"
},

View File

@ -211,9 +211,6 @@
"deleteNetwork": {
"message": "Slette nettverk? "
},
"deleteNetworkDescription": {
"message": "Er du sikker på at du vil slette dette nettverket?"
},
"details": {
"message": "Detaljer"
},

View File

@ -409,9 +409,6 @@
"deleteNetwork": {
"message": "I-delete ang Network?"
},
"deleteNetworkDescription": {
"message": "Sigurado ka bang gusto mong i-delete ang network na ito?"
},
"details": {
"message": "Mga Detalye"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Usunąć sieć?"
},
"deleteNetworkDescription": {
"message": "Czy na pewno chcesz usunąć tę sieć?"
},
"details": {
"message": "Szczegóły"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Excluir rede?"
},
"deleteNetworkDescription": {
"message": "Quer mesmo excluir essa rede?"
},
"deposit": {
"message": "Depositar"
},

View File

@ -584,9 +584,6 @@
"deleteNetwork": {
"message": "Excluir rede?"
},
"deleteNetworkDescription": {
"message": "Quer mesmo excluir essa rede?"
},
"description": {
"message": "Descrição"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Ștergeți rețeaua?"
},
"deleteNetworkDescription": {
"message": "Sigur vreți să ștergeți această rețea?"
},
"details": {
"message": "Detalii"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Удалить сеть?"
},
"deleteNetworkDescription": {
"message": "Уверены, что хотите удалить эту сеть?"
},
"deposit": {
"message": "Внести деньги"
},

View File

@ -208,9 +208,6 @@
"deleteNetwork": {
"message": "Odstrániť sieť?"
},
"deleteNetworkDescription": {
"message": "Naozaj chcete túto sieť odstrániť?"
},
"details": {
"message": "Podrobnosti"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Izbrišem to omrežje?"
},
"deleteNetworkDescription": {
"message": "Ali ste prepričani, da želite izbrisati to omrežje?"
},
"details": {
"message": "Podrobnosti"
},

View File

@ -211,9 +211,6 @@
"deleteNetwork": {
"message": "Da li želite da obrišete mrežu?"
},
"deleteNetworkDescription": {
"message": "Da li ste sigurni da želite da izbrišete ovu mrežu?"
},
"details": {
"message": "Детаљи"
},

View File

@ -208,9 +208,6 @@
"deleteNetwork": {
"message": "Radera nätverk?"
},
"deleteNetworkDescription": {
"message": "Är du säker på att du vill ta bort detta nätverk?"
},
"details": {
"message": "Info"
},

View File

@ -208,9 +208,6 @@
"deleteNetwork": {
"message": "Futa Mtandao?"
},
"deleteNetworkDescription": {
"message": "Una uhakika unataka kufuta mtandao huu?"
},
"details": {
"message": "Maelezo"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "I-delete ang network?"
},
"deleteNetworkDescription": {
"message": "Sigurado ka bang gusto mong i-delete ang network na ito?"
},
"deposit": {
"message": "Deposito"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Ağı Sil?"
},
"deleteNetworkDescription": {
"message": "Bu ağı silmek istediğinizden emin misiniz?"
},
"deposit": {
"message": "Para Yatır"
},

View File

@ -214,9 +214,6 @@
"deleteNetwork": {
"message": "Видалити мережу?"
},
"deleteNetworkDescription": {
"message": "Ви впевнені, що хочете видалити цю мережу?"
},
"details": {
"message": "Деталі"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "Xóa mạng?"
},
"deleteNetworkDescription": {
"message": "Bạn có chắc chắn muốn xóa mạng này không?"
},
"deposit": {
"message": "Nạp"
},

View File

@ -908,9 +908,6 @@
"deleteNetwork": {
"message": "删除网络?"
},
"deleteNetworkDescription": {
"message": "您确定要删除该网络吗?"
},
"deposit": {
"message": "存入"
},

View File

@ -411,9 +411,6 @@
"deleteNetwork": {
"message": "刪除網路?"
},
"deleteNetworkDescription": {
"message": "你確定要刪除網路嗎?"
},
"details": {
"message": "詳情"
},

View File

@ -14,12 +14,12 @@ exports[`Confirm Delete Network should match snapshot 1`] = `
<div
class="modal-content__title"
>
Delete network?
Delete Custom Mainnet RPC network?
</div>
<div
class="modal-content__description"
>
Are you sure you want to delete this network?
If you delete this network, you will need to add it again to view your assets in this network
</div>
</div>
</div>

View File

@ -8,21 +8,22 @@ export default class ConfirmDeleteNetwork extends PureComponent {
removeNetworkConfiguration: PropTypes.func.isRequired,
onConfirm: PropTypes.func.isRequired,
target: PropTypes.string.isRequired,
networkNickname: PropTypes.string.isRequired,
};
static contextTypes = {
t: PropTypes.func,
};
handleDelete = () => {
this.props.removeNetworkConfiguration(this.props.target).then(() => {
this.props.onConfirm();
this.props.hideModal();
});
handleDelete = async () => {
await this.props.removeNetworkConfiguration(this.props.target);
this.props.onConfirm();
this.props.hideModal();
};
render() {
const { t } = this.context;
const { networkNickname } = this.props;
return (
<Modal
@ -33,8 +34,8 @@ export default class ConfirmDeleteNetwork extends PureComponent {
submitType="danger-primary"
>
<ModalContent
title={t('deleteNetwork')}
description={t('deleteNetworkDescription')}
title={t('deleteNetworkTitle', [networkNickname])}
description={t('deleteNetworkIntro')}
/>
</Modal>
);

View File

@ -2,8 +2,16 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props';
import { removeNetworkConfiguration } from '../../../../store/actions';
import { getNetworkConfigurations } from '../../../../selectors';
import ConfirmDeleteNetwork from './confirm-delete-network.component';
const mapStateToProps = (state, ownProps) => {
const networkConfigurations = getNetworkConfigurations(state);
const networkNickname = networkConfigurations[ownProps.target].nickname;
return { networkNickname };
};
const mapDispatchToProps = (dispatch) => {
return {
removeNetworkConfiguration: (target) =>
@ -13,5 +21,5 @@ const mapDispatchToProps = (dispatch) => {
export default compose(
withModalProps,
connect(null, mapDispatchToProps),
connect(mapStateToProps, mapDispatchToProps),
)(ConfirmDeleteNetwork);

View File

@ -10,7 +10,7 @@ describe('Confirm Delete Network', () => {
hideModal: jest.fn(),
onConfirm: jest.fn(),
removeNetworkConfiguration: jest.fn().mockResolvedValue(),
target: 'target',
target: 'testNetworkConfigurationId',
};
it('should match snapshot', () => {
@ -23,6 +23,17 @@ describe('Confirm Delete Network', () => {
expect(container).toMatchSnapshot();
});
it('should mention network name in modal', () => {
const mockStore = configureMockStore()(mockState);
const { getByText } = renderWithProvider(
<ConfirmDeleteNetwork {...props} />,
mockStore,
);
const expectedTitle = 'Delete Custom Mainnet RPC network?';
expect(getByText(expectedTitle)).toBeInTheDocument();
});
it('clicks cancel to hide modal', async () => {
const { queryByText } = renderWithProvider(
<ConfirmDeleteNetwork.WrappedComponent {...props} />,