From badd03f3a398cf8e0988ab1850c44cdcfc2d39ca Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 28 May 2016 09:50:45 +0930 Subject: [PATCH] Give the hidden/trash badge precedence over the awaiting approval badge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.) --- extensions/approval/js/forum/dist/extension.js | 3 +-- extensions/approval/js/forum/src/main.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/extensions/approval/js/forum/dist/extension.js b/extensions/approval/js/forum/dist/extension.js index ba6956303..6ab85e2a7 100644 --- a/extensions/approval/js/forum/dist/extension.js +++ b/extensions/approval/js/forum/dist/extension.js @@ -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') })); } }); diff --git a/extensions/approval/js/forum/src/main.js b/extensions/approval/js/forum/src/main.js index 813ca70ac..843f07c02 100644 --- a/extensions/approval/js/forum/src/main.js +++ b/extensions/approval/js/forum/src/main.js @@ -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', ); } });