Handle pending changes for contributions

This adds the pending tx data to pending contributions (after adding or
vetoing, until the tx is mined). It also disables the veto button while
pending.
This commit is contained in:
2019-09-20 15:43:34 +02:00
parent 51d8b6c8c1
commit 1deecafee7
4 changed files with 25 additions and 3 deletions
+4
View File
@@ -225,6 +225,7 @@ export default Service.extend({
console.debug('[kredits] add contribution response', data);
attributes.contributor = this.contributors.findBy('id', attributes.contributorId);
const contribution = Contribution.create(attributes);
contribution.set('pendingTx', data);
contribution.set('confirmedAtBlock', data.blockNumber + 40320);
this.contributions.pushObject(contribution);
return contribution;
@@ -278,10 +279,12 @@ export default Service.extend({
veto (contributionId) {
console.debug('[kredits] veto against', contributionId);
const contribution = this.contributions.findBy('id', contributionId);
return this.kredits.Contribution.functions.veto(contributionId, { gasLimit: 300000 })
.then(data => {
console.debug('[kredits] veto response', data);
contribution.set('pendingTx', data);
return data;
});
},
@@ -367,6 +370,7 @@ export default Service.extend({
if (contribution) {
contribution.set('vetoed', true);
contribution.set('pendingTx', null);
}
},