From b28f6e6bd758befe22d2ca38e01bb147574c69c9 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Fri, 20 Sep 2019 11:17:38 +0200 Subject: [PATCH 1/3] Use official kredits-contracts npm release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e3a565f..7006ed5 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "eslint-plugin-node": "^9.0.1", "ethers": "^4.0.27", "kosmos-schemas": "^2.0.0", - "kredits-contracts": "github:67P/kredits-contracts#master", + "kredits-contracts": "^5.5.0", "loader.js": "^4.7.0", "ndjson": "github:hugomrdias/ndjson#feat/readable-stream3", "qunit-dom": "^0.8.4", From 8e7430ebb933e234c2fbaabb7f24ce7d9796820a Mon Sep 17 00:00:00 2001 From: Garret Alfert Date: Fri, 20 Sep 2019 18:27:40 +0200 Subject: [PATCH 2/3] Make contribution-status helper recompute When any of the depending properties of the contribution changes, the helper recomputes its output. --- app/components/contribution-list/template.hbs | 2 +- app/helpers/contribution-status.js | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/components/contribution-list/template.hbs b/app/components/contribution-list/template.hbs index d6495a6..dab6a13 100644 --- a/app/components/contribution-list/template.hbs +++ b/app/components/contribution-list/template.hbs @@ -33,7 +33,7 @@ {{#each contributionsFiltered as |contribution|}}
  • + class="{{contribution-status contribution}}{{if (eq contribution.id selectedContributionId) " selected"}}">

    {{user-avatar contributor=contribution.contributor}} ({{contribution.kind}}) diff --git a/app/helpers/contribution-status.js b/app/helpers/contribution-status.js index 79e4bbb..affdf12 100644 --- a/app/helpers/contribution-status.js +++ b/app/helpers/contribution-status.js @@ -1,6 +1,7 @@ import Helper from '@ember/component/helper'; import { inject as service } from '@ember/service'; import { alias } from '@ember/object/computed'; +import { once } from '@ember/runloop'; export default Helper.extend({ @@ -8,6 +9,8 @@ export default Helper.extend({ currentBlock: alias('kredits.currentBlock'), compute([contribution]) { + this.setupRecompute(contribution); + if (contribution.vetoed) { return 'vetoed'; } else if (contribution.confirmedAt > this.currentBlock) { @@ -15,6 +18,31 @@ export default Helper.extend({ } else { return 'confirmed' } + }, + + destroy () { + if (this.teardown) this.teardown(); + this._super(...arguments); + }, + + setupRecompute (contribution) { + if (this.teardown) this.teardown(); + + contribution.addObserver('vetoed' , this, this.triggerRecompute); + contribution.addObserver('confirmedAt' , this, this.triggerRecompute); + contribution.addObserver('currentBlock' , this, this.triggerRecompute); + + this.teardown = () => { + contribution.removeObserver('vetoed', this, this.triggerRecompute); + contribution.removeObserver('confirmedAt', this, this.triggerRecompute); + contribution.removeObserver('currentBlock', this, this.triggerRecompute); + }; + }, + + triggerRecompute () { + once(this, function () { + this.recompute(); + }); } }); From ec701b3130e4bc63d428658de1752139f1d72070 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Fri, 20 Sep 2019 23:45:33 +0200 Subject: [PATCH 3/3] Update lockfile --- package-lock.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3eadc5b..076fa42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11705,8 +11705,9 @@ } }, "kredits-contracts": { - "version": "github:67P/kredits-contracts#eded4a811fc3d1e4f8ae505e2c3d212952ea9c0e", - "from": "github:67P/kredits-contracts#master", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.5.0.tgz", + "integrity": "sha512-kiiKySe7plOeywiJv+0E2MfUxQ56yTUamrQzVqLjyTssHWtjv7Nv+/EoYnVXgWHBcGouh02QzmxrYJYpAAS6Ig==", "dev": true, "requires": { "ethers": "^4.0.29",