Give the hidden/trash badge precedence over the awaiting approval badge

Given flarum/core@2d5a7ce, the hidden badge will no longer display for discussions awaiting approval – it will only display if the discussion has *actually* been marked as deleted by the OP. Thus, this information should have precedence. (There isn't much point in displaying both badges, I don't think.)
This commit is contained in:
Toby Zerner 2016-05-28 09:50:45 +09:30
parent 0bd3c16084
commit badd03f3a3
2 changed files with 2 additions and 4 deletions

View File

@ -31,8 +31,7 @@ System.register('flarum/approval/main', ['flarum/extend', 'flarum/app', 'flarum/
Discussion.prototype.isApproved = Discussion.attribute('isApproved');
extend(Discussion.prototype, 'badges', function (items) {
if (!this.isApproved()) {
items.remove('hidden');
if (!this.isApproved() && !items.has('hidden')) {
items.add('awaitingApproval', m(Badge, { type: 'awaitingApproval', icon: 'gavel', label: app.translator.trans('flarum-approval.forum.badge.awaiting_approval_tooltip') }));
}
});

View File

@ -13,8 +13,7 @@ app.initializers.add('flarum-approval', () => {
Discussion.prototype.isApproved = Discussion.attribute('isApproved');
extend(Discussion.prototype, 'badges', function(items) {
if (!this.isApproved()) {
items.remove('hidden');
if (!this.isApproved() && !items.has('hidden')) {
items.add('awaitingApproval', <Badge type="awaitingApproval" icon="gavel" label={app.translator.trans('flarum-approval.forum.badge.awaiting_approval_tooltip')}/>);
}
});