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();
+ });
}
});