Skip to content

Commit

Permalink
Merge pull request #358 from cosmos/peng/357-fix-double-self-tx
Browse files Browse the repository at this point in the history
Peng/357 fix double self tx
  • Loading branch information
nylira authored Jan 17, 2018
2 parents 7fb4087 + 1c8935a commit 1635dec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 12 additions & 2 deletions app/src/renderer/components/wallet/LiTransaction.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template lang='pug'>
.ni-li-tx.ni-li-tx-sent(v-if="sent" @click="() => devMode && viewTransaction()")
.tx-icon: i.material-icons remove_circle
mixin tx-container-sent
.tx-container
.tx-element.tx-coins
.tx-coin(v-for='coin in coinsSent')
Expand All @@ -9,6 +8,14 @@
.tx-element.tx-date(v-if="devMode") {{ date }}
.tx-element.tx-address {{ receiver }}

.ni-li-tx(v-if="sentSelf" @click="() => devMode && viewTransaction()")
.tx-icon: i.material-icons swap_horiz
+tx-container-sent

.ni-li-tx.ni-li-tx-sent(v-else-if="sent" @click="() => devMode && viewTransaction()")
.tx-icon: i.material-icons remove_circle
+tx-container-sent

.ni-li-tx.ni-li-tx-received(v-else @click="() => devMode && viewTransaction()")
.tx-icon: i.material-icons add_circle
.tx-container
Expand All @@ -27,6 +34,9 @@ export default {
name: 'ni-li-tx',
computed: {
// TODO: sum relevant inputs/outputs
sentSelf () {
return this.transactionValue.tx.inputs[0].sender === this.transactionValue.tx.outputs[0].receiver
},
sent () {
return this.transactionValue.tx.inputs[0].sender === this.address
},
Expand Down
5 changes: 3 additions & 2 deletions app/src/renderer/components/wallet/PageTransactions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ page(title='Transactions')
<script>
import shortid from 'shortid'
import { mapGetters } from 'vuex'
import { includes, orderBy } from 'lodash'
import { includes, orderBy, uniqBy } from 'lodash'
import Mousetrap from 'mousetrap'
import DataEmptySearch from 'common/NiDataEmptySearch'
import DataEmptyTx from 'common/NiDataEmptyTx'
Expand All @@ -44,7 +44,8 @@ export default {
computed: {
...mapGetters(['filters', 'transactions', 'wallet', 'config']),
orderedTransactions () {
return orderBy(this.transactions, [this.sort.property], [this.sort.order])
let list = orderBy(this.transactions, [this.sort.property], [this.sort.order])
return uniqBy(list, 'time') // filter out duplicate tx to self
},
filteredTransactions () {
let query = this.filters.transactions.search.query
Expand Down

0 comments on commit 1635dec

Please sign in to comment.