diff --git a/src/components/transactions/transactionList.js b/src/components/transactions/transactionList.js index 93f45e2c6b..4a15a6dec0 100644 --- a/src/components/transactions/transactionList.js +++ b/src/components/transactions/transactionList.js @@ -6,6 +6,7 @@ import TransactionRow from './transactionRow'; import TransactionsHeader from './transactionsHeader'; import { transactionsRequestInit } from '../../actions/transactions'; import txFilters from './../../constants/transactionFilters'; +import txTypes from './../../constants/transactionTypes'; import styles from './transactions.css'; class TransactionsList extends React.Component { @@ -27,17 +28,28 @@ class TransactionsList extends React.Component { } render() { + const fixIncomingFilter = (transaction) => { + const isTypeNonSend = transaction.type !== txTypes.send; + const isFilterIncoming = this.props.filter + && this.props.filter.value === txFilters.incoming; + const isAccountInit = transaction.type === txTypes.send + && transaction.senderId === transaction.recipientId; + + return !(isFilterIncoming && (isTypeNonSend || isAccountInit)); + }; + if (this.props.transactions.length > 0) { return
- {this.props.transactions.map((transaction, i) => ( - - ))} + {this.props.transactions + .filter(fixIncomingFilter) + .map((transaction, i) => ( + ))} { // the transaction list should be scrollable on a large screen // otherwise (XS) the whole transaction box will be scrollable diff --git a/test/integration/accountTransactions.test.js b/test/integration/accountTransactions.test.js index e7ff2b0f7e..ba3da61509 100644 --- a/test/integration/accountTransactions.test.js +++ b/test/integration/accountTransactions.test.js @@ -15,6 +15,7 @@ import accountMiddleware from '../../src/store/middlewares/account'; import transactionsMiddleware from '../../src/store/middlewares/transactions'; import { activePeerSet } from '../../src/actions/peers'; import networks from './../../src/constants/networks'; +import txTypes from './../../src/constants/transactionTypes'; import getNetwork from './../../src/utils/getNetwork'; import { accountLoggedIn } from '../../src/actions/account'; import AccountTransactions from './../../src/components/accountTransactions'; @@ -31,7 +32,7 @@ describe('@integration: Account Transactions', () => { requestToActivePeerStub = stub(peers, 'requestToActivePeer'); accountAPIStub = stub(accountAPI, 'getAccount'); - const transactionExample = { senderId: '456L', receiverId: '456L' }; + const transactionExample = { senderId: '456L', receiverId: '456L', type: txTypes.send }; // specific address let transactions = new Array(20); @@ -42,6 +43,7 @@ describe('@integration: Account Transactions', () => { // incoming transaction result transactions = new Array(15); transactions.fill(transactionExample); + transactions.push({ senderId: 'sample_address', receiverId: 'some_address', type: txTypes.vote }); requestToActivePeerStub.withArgs(match.any, 'transactions', match({ senderId: undefined })) .returnsPromise().resolves({ transactions, count: 1000 }); diff --git a/test/integration/wallet.test.js b/test/integration/wallet.test.js index 6b43b84c40..805bc0a9ea 100644 --- a/test/integration/wallet.test.js +++ b/test/integration/wallet.test.js @@ -17,6 +17,7 @@ import transactionsMiddleware from '../../src/store/middlewares/transactions'; import { accountLoggedIn } from '../../src/actions/account'; import { activePeerSet } from '../../src/actions/peers'; import networks from './../../src/constants/networks'; +import txTypes from './../../src/constants/transactionTypes'; import getNetwork from './../../src/utils/getNetwork'; import Wallet from '../../src/components/transactionDashboard'; import accounts from '../constants/accounts'; @@ -39,7 +40,7 @@ describe('@integration: Wallet', () => { localStorageStub = stub(localStorage, 'getItem'); localStorageStub.withArgs('accounts').returns(JSON.stringify([{}, {}])); - const transactionExample = { senderId: 'sample_address', receiverId: 'some_address' }; + const transactionExample = { senderId: 'sample_address', receiverId: 'some_address', type: txTypes.send }; requestToActivePeerStub.withArgs(match.any, 'transactions', match({ recipientId: '537318935439898807L', @@ -56,6 +57,7 @@ describe('@integration: Wallet', () => { // incoming transaction result transactions = new Array(15); transactions.fill(transactionExample); + transactions.push({ senderId: 'sample_address', receiverId: 'some_address', type: txTypes.vote }); requestToActivePeerStub.withArgs(match.any, 'transactions', match({ senderId: undefined })) .returnsPromise().resolves({ transactions, count: 1000 });