minor fixes

This commit is contained in:
mmv 2019-07-10 14:56:36 +04:00
parent 276334f8f8
commit a199b0588a
2 changed files with 14 additions and 16 deletions

View File

@ -52,25 +52,23 @@ const OwnersColumn = ({
const cancellationTx = isCancellationTransaction(tx, safeAddress) const cancellationTx = isCancellationTransaction(tx, safeAddress)
const ownersWhoConfirmed = [] const ownersWhoConfirmed = []
const ownersUnconfirmed = []
let currentUserAlreadyConfirmed = false let currentUserAlreadyConfirmed = false
let executionConfirmation let executionConfirmation
owners.forEach((owner) => {
const ownerConfirmation = tx.confirmations.find(conf => conf.owner.address === owner.address)
if (ownerConfirmation) {
if (ownerConfirmation.type === TX_TYPE_CONFIRMATION) {
ownersWhoConfirmed.push(owner)
} else {
executionConfirmation = owner
}
if (owner.address === userAddress) { tx.confirmations.forEach((conf) => {
currentUserAlreadyConfirmed = true if (conf.owner.address === userAddress) {
} currentUserAlreadyConfirmed = true
}
if (conf.type === TX_TYPE_CONFIRMATION) {
ownersWhoConfirmed.push(conf.owner)
} else { } else {
ownersUnconfirmed.push(owner) executionConfirmation = conf.owner
} }
}) })
const ownersUnconfirmed = owners.filter(
owner => tx.confirmations.findIndex(conf => conf.owner.address === owner.address) === -1,
)
let displayButtonRow = true let displayButtonRow = true
if (tx.executionTxHash) { if (tx.executionTxHash) {
@ -86,7 +84,7 @@ const OwnersColumn = ({
} }
const confirmedLabel = `Confirmed [${tx.confirmations.size}/${threshold}]` const confirmedLabel = `Confirmed [${tx.confirmations.size}/${threshold}]`
const unconfirmedLabel = `Unconfirmed [${owners.size - tx.confirmations.size}]` const unconfirmedLabel = `Unconfirmed [${ownersUnconfirmed.size}]`
return ( return (
<Col xs={6} className={classes.rightCol} layout="block"> <Col xs={6} className={classes.rightCol} layout="block">

View File

@ -36,11 +36,11 @@ export type SelectorProps = {
const getTxStatus = (tx: Transaction, safe: Safe): TransactionStatus => { const getTxStatus = (tx: Transaction, safe: Safe): TransactionStatus => {
let txStatus = 'awaiting_confirmations' let txStatus = 'awaiting_confirmations'
if (tx.isExecuted) { if (tx.executionTxHash) {
txStatus = 'success' txStatus = 'success'
} else if (tx.cancelled) { } else if (tx.cancelled) {
txStatus = 'cancelled' txStatus = 'cancelled'
} else if (tx.confirmations.size === safe.owners.size) { } else if (tx.confirmations.size === safe.threshold) {
txStatus = 'awaiting_execution' txStatus = 'awaiting_execution'
} }