From 64ba876ff4fcaa43c8b2d699af5910d9c94d9216 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 1 Feb 2018 11:33:48 -0500 Subject: [PATCH] FIX: Don't show "Grant Badge" if badges are disabled --- .../discourse/widgets/post-admin-menu.js.es6 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 b/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 index d79580ae45a..32f0a43c389 100644 --- a/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 @@ -10,7 +10,7 @@ createWidget('post-admin-menu-button', jQuery.extend(ButtonClass, { } })); -export function buildManageButtons(attrs, currentUser) { +export function buildManageButtons(attrs, currentUser, siteSettings) { if (!currentUser) { return []; } @@ -67,12 +67,14 @@ export function buildManageButtons(attrs, currentUser) { } if (currentUser.staff) { - contents.push({ - icon: 'certificate', - label: 'post.controls.grant_badge', - action: 'grantBadge', - className: 'grant-badge' - }); + if (siteSettings.enable_badges) { + contents.push({ + icon: 'certificate', + label: 'post.controls.grant_badge', + action: 'grantBadge', + className: 'grant-badge' + }); + } const action = attrs.locked ? "unlock" : "lock"; contents.push({ @@ -112,7 +114,7 @@ export default createWidget('post-admin-menu', { const contents = []; contents.push(h('h3', I18n.t('admin_title'))); - buildManageButtons(this.attrs, this.currentUser).forEach(b => { + buildManageButtons(this.attrs, this.currentUser, this.siteSettings).forEach(b => { contents.push(this.attach('post-admin-menu-button', b)); });