Make contribution-status helper detect pending changes
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
{{#each contributionsFiltered as |contribution|}}
|
{{#each contributionsFiltered as |contribution|}}
|
||||||
<li role="button" {{action "openContributionDetails" contribution}}
|
<li role="button" {{action "openContributionDetails" contribution}}
|
||||||
data-contribution-id={{contribution.id}}
|
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">
|
<p class="meta">
|
||||||
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
||||||
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
||||||
|
|||||||
@@ -11,13 +11,23 @@ export default Helper.extend({
|
|||||||
compute([contribution]) {
|
compute([contribution]) {
|
||||||
this.setupRecompute(contribution);
|
this.setupRecompute(contribution);
|
||||||
|
|
||||||
|
let status = [];
|
||||||
|
|
||||||
if (contribution.vetoed) {
|
if (contribution.vetoed) {
|
||||||
return 'vetoed';
|
status.push('vetoed');
|
||||||
} else if (contribution.confirmedAt > this.currentBlock) {
|
} else if (contribution.confirmedAt > this.currentBlock) {
|
||||||
return 'unconfirmed';
|
status.push('unconfirmed');
|
||||||
} else {
|
} else {
|
||||||
return 'confirmed'
|
status.push('confirmed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (contribution.hasPendingChanges) {
|
||||||
|
status.push('pending');
|
||||||
|
}
|
||||||
|
|
||||||
|
status.push('pending');
|
||||||
|
|
||||||
|
return status.join(' ');
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy () {
|
destroy () {
|
||||||
@@ -31,11 +41,13 @@ export default Helper.extend({
|
|||||||
contribution.addObserver('vetoed' , this, this.triggerRecompute);
|
contribution.addObserver('vetoed' , this, this.triggerRecompute);
|
||||||
contribution.addObserver('confirmedAt' , this, this.triggerRecompute);
|
contribution.addObserver('confirmedAt' , this, this.triggerRecompute);
|
||||||
contribution.addObserver('currentBlock' , this, this.triggerRecompute);
|
contribution.addObserver('currentBlock' , this, this.triggerRecompute);
|
||||||
|
contribution.addObserver('hasPendingChanges' , this, this.triggerRecompute);
|
||||||
|
|
||||||
this.teardown = () => {
|
this.teardown = () => {
|
||||||
contribution.removeObserver('vetoed', this, this.triggerRecompute);
|
contribution.removeObserver('vetoed', this, this.triggerRecompute);
|
||||||
contribution.removeObserver('confirmedAt', this, this.triggerRecompute);
|
contribution.removeObserver('confirmedAt', this, this.triggerRecompute);
|
||||||
contribution.removeObserver('currentBlock', this, this.triggerRecompute);
|
contribution.removeObserver('currentBlock', this, this.triggerRecompute);
|
||||||
|
contribution.removeObserver('hadPendingChanges', this, this.triggerRecompute);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user