From 523d4524b54af3b28d6a476d7b8ec8ef85ba874f Mon Sep 17 00:00:00 2001 From: Garret Alfert Date: Fri, 18 Oct 2019 16:37:44 +0200 Subject: [PATCH] Make contribution-status helper detect pending changes --- app/components/contribution-list/template.hbs | 2 +- app/helpers/contribution-status.js | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/components/contribution-list/template.hbs b/app/components/contribution-list/template.hbs index a0bd083..49419cb 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 affdf12..4f8ea38 100644 --- a/app/helpers/contribution-status.js +++ b/app/helpers/contribution-status.js @@ -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); }; },