mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Ensure the test network dismissal message in the network dropdown is permanently dismissed (#12723)
This commit is contained in:
parent
18969db4f7
commit
ab8db945cd
@ -30,6 +30,7 @@ export default class AppStateController extends EventEmitter {
|
||||
fullScreenGasPollTokens: [],
|
||||
recoveryPhraseReminderHasBeenShown: false,
|
||||
recoveryPhraseReminderLastShown: new Date().getTime(),
|
||||
showTestnetMessageInDropdown: true,
|
||||
...initState,
|
||||
});
|
||||
this.timer = null;
|
||||
@ -228,4 +229,12 @@ export default class AppStateController extends EventEmitter {
|
||||
fullScreenGasPollTokens: [],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the testnet dismissal link should be shown in the network dropdown
|
||||
* @returns {void}
|
||||
*/
|
||||
setShowTestnetMessageInDropdown(showTestnetMessageInDropdown) {
|
||||
this.store.updateState({ showTestnetMessageInDropdown });
|
||||
}
|
||||
}
|
||||
|
@ -979,6 +979,10 @@ export default class MetamaskController extends EventEmitter {
|
||||
this.appStateController.setRecoveryPhraseReminderLastShown,
|
||||
this.appStateController,
|
||||
),
|
||||
setShowTestnetMessageInDropdown: nodeify(
|
||||
this.appStateController.setShowTestnetMessageInDropdown,
|
||||
this.appStateController,
|
||||
),
|
||||
|
||||
// EnsController
|
||||
tryReverseResolveAddress: nodeify(
|
||||
|
@ -43,7 +43,7 @@ function mapStateToProps(state) {
|
||||
shouldShowTestNetworks: getShowTestNetworks(state),
|
||||
frequentRpcListDetail: state.metamask.frequentRpcListDetail || [],
|
||||
networkDropdownOpen: state.appState.networkDropdownOpen,
|
||||
showTestnetMessageInDropdown: state.appState.showTestnetMessageInDropdown,
|
||||
showTestnetMessageInDropdown: state.metamask.showTestnetMessageInDropdown,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@ export default function reduceApp(state = {}, action) {
|
||||
ledgerWebHidConnectedStatus: WEBHID_CONNECTED_STATUSES.UNKNOWN,
|
||||
ledgerTransportStatus: TRANSPORT_STATES.NONE,
|
||||
newNetworkAdded: '',
|
||||
showTestnetMessageInDropdown: true,
|
||||
...state,
|
||||
};
|
||||
|
||||
@ -73,12 +72,6 @@ export default function reduceApp(state = {}, action) {
|
||||
networkDropdownOpen: false,
|
||||
};
|
||||
|
||||
case actionConstants.HIDE_TESTNET_MESSAGE:
|
||||
return {
|
||||
...appState,
|
||||
showTestnetMessageInDropdown: false,
|
||||
};
|
||||
|
||||
// alert methods
|
||||
case actionConstants.ALERT_OPEN:
|
||||
return {
|
||||
|
@ -38,16 +38,6 @@ describe('App State', () => {
|
||||
expect(newState.networkDropdownOpen).toStrictEqual(false);
|
||||
});
|
||||
|
||||
it('sets showTestnetMessageInDropdown dropdown to false', () => {
|
||||
const testnetMessage = { showTestnetMessageInDropdown: true };
|
||||
const state = { ...metamaskState, ...testnetMessage };
|
||||
const newState = reduceApp(state, {
|
||||
type: actions.HIDE_TESTNET_MESSAGE,
|
||||
});
|
||||
|
||||
expect(newState.showTestnetMessageInDropdown).toStrictEqual(false);
|
||||
});
|
||||
|
||||
it('opens alert', () => {
|
||||
const state = reduceApp(metamaskState, {
|
||||
type: actions.ALERT_OPEN,
|
||||
|
@ -9,8 +9,6 @@ export const QR_CODE_DETECTED = 'UI_QR_CODE_DETECTED';
|
||||
// network dropdown open
|
||||
export const NETWORK_DROPDOWN_OPEN = 'UI_NETWORK_DROPDOWN_OPEN';
|
||||
export const NETWORK_DROPDOWN_CLOSE = 'UI_NETWORK_DROPDOWN_CLOSE';
|
||||
// network dropdown
|
||||
export const HIDE_TESTNET_MESSAGE = 'HIDE_TESTNET_MESSAGE';
|
||||
// remote state
|
||||
export const UPDATE_METAMASK_STATE = 'UPDATE_METAMASK_STATE';
|
||||
export const SELECTED_ADDRESS_CHANGED = 'SELECTED_ADDRESS_CHANGED';
|
||||
|
@ -1658,12 +1658,6 @@ export function hideNetworkDropdown() {
|
||||
};
|
||||
}
|
||||
|
||||
export function hideTestNetMessage() {
|
||||
return {
|
||||
type: actionConstants.HIDE_TESTNET_MESSAGE,
|
||||
};
|
||||
}
|
||||
|
||||
export function showModal(payload) {
|
||||
return {
|
||||
type: actionConstants.MODAL_OPEN,
|
||||
@ -2937,3 +2931,7 @@ export async function setWeb3ShimUsageAlertDismissed(origin) {
|
||||
export async function detectNewTokens() {
|
||||
return promisifiedBackground.detectNewTokens();
|
||||
}
|
||||
|
||||
export function hideTestNetMessage() {
|
||||
return promisifiedBackground.setShowTestnetMessageInDropdown(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user