Merge branch 'master' into feature/pending_changes
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
{{#each contributionsFiltered as |contribution|}}
|
||||
<li role="button" {{action "openContributionDetails" contribution}}
|
||||
data-contribution-id={{contribution.id}}
|
||||
class="{{contribution-status contribution}}{{if contribution.hasPendingChanges " pending"}}{{if contribution.vetoed " vetoed"}}{{if (eq contribution.id selectedContributionId) " selected"}}">
|
||||
class="{{contribution-status contribution}}{{if contribution.hasPendingChanges " pending"}}{{if (eq contribution.id selectedContributionId) " selected"}}">
|
||||
<p class="meta">
|
||||
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
||||
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Generated
+3
-2
@@ -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",
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user