fix: disable offers if arbitrator rejects seller (#584)

This commit is contained in:
Richard Ramos 2020-01-07 10:46:58 -04:00 committed by GitHub
parent 89002f9e1b
commit 754f158407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -263,6 +263,7 @@
"rate": "Rate",
"locationLoading": "Calculating location distance...",
"noUsername": "No Username",
"noArbitrator": "No arbitrator",
"deleteOffer": "Delete offer",
"hiddenOffers": "Other assets are hidden until you have ETH in your wallet"
},

View File

@ -9,6 +9,7 @@ import ConfirmDialog from "../../../components/ConfirmDialog";
import {CURRENCY_DATA} from "../../../constants/currencies";
import classnames from 'classnames';
import iconDelete from '../../../../images/delete.svg';
import { addressCompare, zeroAddress } from '../../../utils/address';
class Offers extends Component {
state = {
@ -72,7 +73,7 @@ class Offers extends Component {
<Row>
<dl className="col-12">
<dt>Arbitrator</dt>
<dd>{offer.arbitratorData ? offer.arbitratorData.username : t('offers.noUsername')} ({offer.arbitrator})</dd>
<dd>{offer.arbitratorData ? (offer.arbitratorData.username || t('offers.noUsername')) : t('offers.noArbitrator')} ({offer.arbitrator})</dd>
</dl>
</Row>
</CardBody>
@ -91,8 +92,8 @@ class Offers extends Component {
render() {
const {t, offers} = this.props;
const activeOffers = offers.filter(x => !x.deleted);
const inactiveOffers = offers.filter(x => x.deleted);
const activeOffers = offers.filter(x => !x.deleted && !addressCompare(x.arbitrator, zeroAddress));
const inactiveOffers = offers.filter(x => x.deleted || addressCompare(x.arbitrator, zeroAddress));
return (
<div className="mt-3">

View File

@ -88,7 +88,7 @@ class MyProfile extends Component {
if(!profile) return <Loading page={true} />;
const activeOffers = profile.offers.filter(x => !x.deleted).length;
const activeOffers = profile.offers.filter(x => !x.deleted && !addressCompare(x.arbitrator, zeroAddress)).length;
const pendingRequests = requests.reduce((a, b) => a + (b.status === arbitration.constants.AWAIT ? 1 : 0), 0);
const openDisputes = this.props.disputes.filter(x => x.arbitration.open && !addressCompare(x.seller, address) && !addressCompare(x.buyer, address) && addressCompare(x.arbitrator, address));
const activeTrades = trades.filter(x => !escrow.helpers.completedStates.includes(x.status)).length;