Make contribution-status helper detect pending changes

This commit is contained in:
2019-10-18 16:37:44 +02:00
parent c21613f20a
commit 523d4524b5
2 changed files with 16 additions and 4 deletions
@@ -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 (eq contribution.id selectedContributionId) " selected"}}">
class="{{contribution-status contribution}}{{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>
+15 -3
View File
@@ -11,13 +11,23 @@ export default Helper.extend({
compute([contribution]) {
this.setupRecompute(contribution);
let status = [];
if (contribution.vetoed) {
return 'vetoed';
status.push('vetoed');
} else if (contribution.confirmedAt > this.currentBlock) {
return 'unconfirmed';
status.push('unconfirmed');
} else {
return 'confirmed'
status.push('confirmed');
}
if (contribution.hasPendingChanges) {
status.push('pending');
}
status.push('pending');
return status.join(' ');
},
destroy () {
@@ -31,11 +41,13 @@ export default Helper.extend({
contribution.addObserver('vetoed' , this, this.triggerRecompute);
contribution.addObserver('confirmedAt' , this, this.triggerRecompute);
contribution.addObserver('currentBlock' , this, this.triggerRecompute);
contribution.addObserver('hasPendingChanges' , this, this.triggerRecompute);
this.teardown = () => {
contribution.removeObserver('vetoed', this, this.triggerRecompute);
contribution.removeObserver('confirmedAt', this, this.triggerRecompute);
contribution.removeObserver('currentBlock', this, this.triggerRecompute);
contribution.removeObserver('hadPendingChanges', this, this.triggerRecompute);
};
},