diff --git a/ui/app/ducks/send/send-duck.test.js b/ui/app/ducks/send/send-duck.test.js index 92c8dffd8..8248ba032 100644 --- a/ui/app/ducks/send/send-duck.test.js +++ b/ui/app/ducks/send/send-duck.test.js @@ -6,7 +6,6 @@ import SendReducer, { updateSendErrors, showGasButtonGroup, hideGasButtonGroup, - updateSendWarnings, } from './send.duck.js' describe('Send Duck', () => { @@ -20,14 +19,12 @@ describe('Send Duck', () => { toDropdownOpen: false, errors: {}, gasButtonGroupShown: true, - warnings: {}, } const OPEN_FROM_DROPDOWN = 'metamask/send/OPEN_FROM_DROPDOWN' const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN' const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN' const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN' const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS' - const UPDATE_SEND_WARNINGS = 'metamask/send/UPDATE_SEND_WARNINGS' const RESET_SEND_STATE = 'metamask/send/RESET_SEND_STATE' const SHOW_GAS_BUTTON_GROUP = 'metamask/send/SHOW_GAS_BUTTON_GROUP' const HIDE_GAS_BUTTON_GROUP = 'metamask/send/HIDE_GAS_BUTTON_GROUP' @@ -176,11 +173,4 @@ describe('Send Duck', () => { ) }) - describe('updateSendWarnings', () => { - assert.deepEqual( - updateSendWarnings('mockWarningObject'), - { type: UPDATE_SEND_WARNINGS, value: 'mockWarningObject' } - ) - }) - }) diff --git a/ui/app/ducks/send/send.duck.js b/ui/app/ducks/send/send.duck.js index 90e92140b..4d212bd03 100644 --- a/ui/app/ducks/send/send.duck.js +++ b/ui/app/ducks/send/send.duck.js @@ -6,7 +6,6 @@ const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN' const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN' const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN' const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS' -const UPDATE_SEND_WARNINGS = 'metamask/send/UPDATE_SEND_WARNINGS' const RESET_SEND_STATE = 'metamask/send/RESET_SEND_STATE' const SHOW_GAS_BUTTON_GROUP = 'metamask/send/SHOW_GAS_BUTTON_GROUP' const HIDE_GAS_BUTTON_GROUP = 'metamask/send/HIDE_GAS_BUTTON_GROUP' @@ -17,7 +16,6 @@ const initState = { toDropdownOpen: false, gasButtonGroupShown: true, errors: {}, - warnings: {}, } // Reducer @@ -48,13 +46,6 @@ export default function reducer ({ send: sendState = initState }, action = {}) { ...action.value, }, }) - case UPDATE_SEND_WARNINGS: - return extend(newState, { - warnings: { - ...newState.warnings, - ...action.value, - }, - }) case SHOW_GAS_BUTTON_GROUP: return extend(newState, { gasButtonGroupShown: true, @@ -94,13 +85,6 @@ export function updateSendErrors (errorObject) { } } -export function updateSendWarnings (warningObject) { - return { - type: UPDATE_SEND_WARNINGS, - value: warningObject, - } -} - export function resetSendState () { return { type: RESET_SEND_STATE } } diff --git a/ui/app/pages/send/send-content/add-recipient/add-recipient.selectors.js b/ui/app/pages/send/send-content/add-recipient/add-recipient.selectors.js index a39db7813..e07da44c9 100644 --- a/ui/app/pages/send/send-content/add-recipient/add-recipient.selectors.js +++ b/ui/app/pages/send/send-content/add-recipient/add-recipient.selectors.js @@ -2,7 +2,6 @@ const selectors = { getToDropdownOpen, getTokens, sendToIsInError, - sendToIsInWarning, } module.exports = selectors @@ -15,10 +14,6 @@ function sendToIsInError (state) { return Boolean(state.send.errors.to) } -function sendToIsInWarning (state) { - return Boolean(state.send.warnings.to) -} - function getTokens (state) { return state.metamask.tokens } diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/index.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/index.js deleted file mode 100644 index fd4d19ef7..000000000 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './send-row-warning-message.container' diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.component.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.component.js deleted file mode 100644 index 6ddddbb3d..000000000 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.component.js +++ /dev/null @@ -1,27 +0,0 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' - -export default class SendRowWarningMessage extends Component { - - static propTypes = { - warnings: PropTypes.object, - warningType: PropTypes.string, - }; - - static contextTypes = { - t: PropTypes.func, - }; - - render () { - const { warnings, warningType } = this.props - - const warningMessage = warningType in warnings && warnings[warningType] - - return ( - warningMessage - ?
{this.context.t(warningMessage)}
- : null - ) - } - -} diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.container.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.container.js deleted file mode 100644 index 7df14fd96..000000000 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.container.js +++ /dev/null @@ -1,12 +0,0 @@ -import { connect } from 'react-redux' -import { getSendWarnings } from '../../../send.selectors' -import SendRowWarningMessage from './send-row-warning-message.component' - -export default connect(mapStateToProps)(SendRowWarningMessage) - -function mapStateToProps (state, ownProps) { - return { - warnings: getSendWarnings(state), - warningType: ownProps.warningType, - } -} diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.scss b/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/send-row-warning-message.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/tests/send-row-warning-message-component.test.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/tests/send-row-warning-message-component.test.js deleted file mode 100644 index bd803d833..000000000 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/tests/send-row-warning-message-component.test.js +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react' -import assert from 'assert' -import { shallow } from 'enzyme' -import SendRowWarningMessage from '../send-row-warning-message.component.js' - -describe('SendRowWarningMessage Component', function () { - let wrapper - - beforeEach(() => { - wrapper = shallow(, { context: { t: str => str + '_t' } }) - }) - - describe('render', () => { - it('should render null if the passed warnings do not contain a warning of warningType', () => { - assert.equal(wrapper.find('.send-v2__warning').length, 0) - assert.equal(wrapper.html(), null) - }) - - it('should render a warning message if the passed warnings contain a warning of warningType', () => { - wrapper.setProps({ warnings: { warning1: 'abc', warning2: 'def', warning3: 'xyz' } }) - assert.equal(wrapper.find('.send-v2__warning').length, 1) - assert.equal(wrapper.find('.send-v2__warning').text(), 'xyz_t') - }) - }) -}) diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/tests/send-row-warning-message-container.test.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/tests/send-row-warning-message-container.test.js deleted file mode 100644 index 6c0739f0e..000000000 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-warning-message/tests/send-row-warning-message-container.test.js +++ /dev/null @@ -1,28 +0,0 @@ -import assert from 'assert' -import proxyquire from 'proxyquire' - -let mapStateToProps - -proxyquire('../send-row-warning-message.container.js', { - 'react-redux': { - connect: (ms) => { - mapStateToProps = ms - return () => ({}) - }, - }, - '../../../send.selectors': { getSendWarnings: (s) => `mockWarnings:${s}` }, -}) - -describe('send-row-warning-message container', () => { - - describe('mapStateToProps()', () => { - - it('should map the correct properties to props', () => { - assert.deepEqual(mapStateToProps('mockState', { warningType: 'someType' }), { - warnings: 'mockWarnings:mockState', - warningType: 'someType' }) - }) - - }) - -}) diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-wrapper.component.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-wrapper.component.js index 075b86633..9ac81576b 100644 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-wrapper.component.js +++ b/ui/app/pages/send/send-content/send-row-wrapper/send-row-wrapper.component.js @@ -1,7 +1,6 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import SendRowErrorMessage from './send-row-error-message' -import SendRowWarningMessage from './send-row-warning-message' export default class SendRowWrapper extends Component { @@ -10,8 +9,6 @@ export default class SendRowWrapper extends Component { errorType: PropTypes.string, label: PropTypes.string, showError: PropTypes.bool, - showWarning: PropTypes.bool, - warningType: PropTypes.string, }; static contextTypes = { @@ -24,8 +21,6 @@ export default class SendRowWrapper extends Component { errorType = '', label, showError = false, - showWarning = false, - warningType = '', } = this.props const formField = Array.isArray(children) ? children[1] || children[0] : children const customLabelContent = children.length > 1 ? children[0] : null @@ -42,7 +37,6 @@ export default class SendRowWrapper extends Component {
{showError && } - {!showError && showWarning && }
@@ -55,8 +49,6 @@ export default class SendRowWrapper extends Component { errorType = '', label, showError = false, - showWarning = false, - warningType = '', } = this.props const formField = Array.isArray(children) ? children[1] || children[0] : children @@ -67,7 +59,6 @@ export default class SendRowWrapper extends Component {
{label} {showError && } - {!showError && showWarning && } {customLabelContent}
diff --git a/ui/app/pages/send/send-header/send-header.component.js b/ui/app/pages/send/send-header/send-header.component.js index 5bc76fcd3..c4c4f866d 100644 --- a/ui/app/pages/send/send-header/send-header.component.js +++ b/ui/app/pages/send/send-header/send-header.component.js @@ -9,7 +9,6 @@ export default class SendHeader extends Component { clearSend: PropTypes.func, history: PropTypes.object, titleKey: PropTypes.string, - subtitleParams: PropTypes.array, }; static contextTypes = { diff --git a/ui/app/pages/send/send-header/send-header.container.js b/ui/app/pages/send/send-header/send-header.container.js index 1a9c5e9c0..7d57a71e9 100644 --- a/ui/app/pages/send/send-header/send-header.container.js +++ b/ui/app/pages/send/send-header/send-header.container.js @@ -1,14 +1,13 @@ import { connect } from 'react-redux' import { clearSend } from '../../../store/actions' import SendHeader from './send-header.component' -import { getSubtitleParams, getTitleKey } from './send-header.selectors' +import { getTitleKey } from './send-header.selectors' export default connect(mapStateToProps, mapDispatchToProps)(SendHeader) function mapStateToProps (state) { return { titleKey: getTitleKey(state), - subtitleParams: getSubtitleParams(state), } } diff --git a/ui/app/pages/send/send-header/send-header.selectors.js b/ui/app/pages/send/send-header/send-header.selectors.js index 01b90409b..cf64caa47 100644 --- a/ui/app/pages/send/send-header/send-header.selectors.js +++ b/ui/app/pages/send/send-header/send-header.selectors.js @@ -6,7 +6,6 @@ const { const selectors = { getTitleKey, - getSubtitleParams, } module.exports = selectors @@ -27,16 +26,3 @@ function getTitleKey (state) { return 'sendETH' } } - -function getSubtitleParams (state) { - const isEditing = Boolean(getSendEditingTransactionId(state)) - const token = getSelectedToken(state) - - if (isEditing) { - return [ 'editingTransaction' ] - } else if (token) { - return [ 'onlySendTokensToAccountAddress', [ token.symbol ] ] - } else { - return [ 'onlySendToEtherAddress' ] - } -} diff --git a/ui/app/pages/send/send-header/tests/send-header-component.test.js b/ui/app/pages/send/send-header/tests/send-header-component.test.js index 91ac7e343..eb74178c7 100644 --- a/ui/app/pages/send/send-header/tests/send-header-component.test.js +++ b/ui/app/pages/send/send-header/tests/send-header-component.test.js @@ -24,7 +24,6 @@ describe('SendHeader Component', function () { clearSend={propsMethodSpies.clearSend} history={historySpies} titleKey={'mockTitleKey'} - subtitleParams={[ 'mockSubtitleKey', 'mockVal']} />, { context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }) }) diff --git a/ui/app/pages/send/send-header/tests/send-header-container.test.js b/ui/app/pages/send/send-header/tests/send-header-container.test.js index fdad8aab3..0ff7491f0 100644 --- a/ui/app/pages/send/send-header/tests/send-header-container.test.js +++ b/ui/app/pages/send/send-header/tests/send-header-container.test.js @@ -20,7 +20,6 @@ proxyquire('../send-header.container.js', { '../../../store/actions': actionSpies, './send-header.selectors': { getTitleKey: (s) => `mockTitleKey:${s}`, - getSubtitleParams: (s) => `mockSubtitleParams:${s}`, }, }) @@ -31,7 +30,6 @@ describe('send-header container', () => { it('should map the correct properties to props', () => { assert.deepEqual(mapStateToProps('mockState'), { titleKey: 'mockTitleKey:mockState', - subtitleParams: 'mockSubtitleParams:mockState', }) }) diff --git a/ui/app/pages/send/send-header/tests/send-header-selectors.test.js b/ui/app/pages/send/send-header/tests/send-header-selectors.test.js index d22845f84..ad47d0cfa 100644 --- a/ui/app/pages/send/send-header/tests/send-header-selectors.test.js +++ b/ui/app/pages/send/send-header/tests/send-header-selectors.test.js @@ -3,7 +3,6 @@ import proxyquire from 'proxyquire' const { getTitleKey, - getSubtitleParams, } = proxyquire('../send-header.selectors', { '../send.selectors': { getSelectedToken: (mockState) => mockState.t, @@ -32,21 +31,4 @@ describe('send-header selectors', () => { }) }) - describe('getSubtitleParams()', () => { - it('should return the correct params when getSendEditingTransactionId is truthy', () => { - assert.deepEqual(getSubtitleParams({ e: 1, t: true, to: '0x123' }), [ 'editingTransaction' ]) - }) - - it('should return the correct params when getSendEditingTransactionId is falsy and getSelectedToken is truthy', () => { - assert.deepEqual( - getSubtitleParams({ e: null, t: { symbol: 'ABC' }, to: '0x123' }), - [ 'onlySendTokensToAccountAddress', [ 'ABC' ] ] - ) - }) - - it('should return the correct params when getSendEditingTransactionId is falsy and getSelectedToken is falsy', () => { - assert.deepEqual(getSubtitleParams({ e: null, to: '0x123' }), [ 'onlySendToEtherAddress' ]) - }) - }) - }) diff --git a/ui/app/pages/send/send.selectors.js b/ui/app/pages/send/send.selectors.js index 00ecd635a..6ca6543ef 100644 --- a/ui/app/pages/send/send.selectors.js +++ b/ui/app/pages/send/send.selectors.js @@ -53,7 +53,6 @@ const selectors = { getSendTo, getSendToAccounts, getSendToNickname, - getSendWarnings, getTokenBalance, getTokenExchangeRate, getUnapprovedTxs, @@ -244,11 +243,6 @@ function getSendToAccounts (state) { const addressBookAccounts = getAddressBook(state) return [...fromAccounts, ...addressBookAccounts] } - -function getSendWarnings (state) { - return state.send.warnings -} - function getTokenBalance (state) { return state.metamask.send.tokenBalance } diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index 0f90e9eab..3e7929619 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -190,7 +190,6 @@ var actions = { UPDATE_SEND_AMOUNT: 'UPDATE_SEND_AMOUNT', UPDATE_SEND_MEMO: 'UPDATE_SEND_MEMO', UPDATE_SEND_ERRORS: 'UPDATE_SEND_ERRORS', - UPDATE_SEND_WARNINGS: 'UPDATE_SEND_WARNINGS', UPDATE_MAX_MODE: 'UPDATE_MAX_MODE', UPDATE_SEND: 'UPDATE_SEND', CLEAR_SEND: 'CLEAR_SEND', @@ -215,7 +214,6 @@ var actions = { setMaxModeTo, updateSend, updateSendErrors, - updateSendWarnings, clearSend, setSelectedAddress, gasLoadingStarted, @@ -1037,13 +1035,6 @@ function updateSendErrors (errorObject) { } } -function updateSendWarnings (warningObject) { - return { - type: actions.UPDATE_SEND_WARNINGS, - value: warningObject, - } -} - function setSendTokenBalance (tokenBalance) { return { type: actions.UPDATE_SEND_TOKEN_BALANCE,