Cache contribution vetos
Fixes potentially not marking contributions as vetoed if there's no incoming event after loading the app. Also improves performance either way.
This commit is contained in:
@@ -675,14 +675,15 @@ export default Service.extend({
|
|||||||
await this.browserCache.contributions.setItem(c.id.toString(), c.serialize());
|
await this.browserCache.contributions.setItem(c.id.toString(), c.serialize());
|
||||||
},
|
},
|
||||||
|
|
||||||
handleContributionVetoed (contributionId) {
|
async handleContributionVetoed (contributionId) {
|
||||||
console.debug('[kredits] ContributionVetoed event received for ', contributionId);
|
console.debug('[kredits] ContributionVetoed event received for ', contributionId);
|
||||||
const contribution = this.contributions.findBy('id', contributionId);
|
const c = this.contributions.findBy('id', contributionId);
|
||||||
console.debug('[kredits] contribution', contribution);
|
|
||||||
|
|
||||||
if (contribution) {
|
if (c) {
|
||||||
contribution.set('vetoed', true);
|
console.debug('[kredits] Updating contribution', c);
|
||||||
contribution.set('pendingTx', null);
|
c.set('vetoed', true);
|
||||||
|
c.set('pendingTx', null);
|
||||||
|
await this.browserCache.contributions.setItem(c.id.toString(), c.serialize());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user