FIX: Don't show "Grant Badge" if badges are disabled
This commit is contained in:
parent
97ddaeeae8
commit
64ba876ff4
|
@ -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) {
|
if (!currentUser) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -67,12 +67,14 @@ export function buildManageButtons(attrs, currentUser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentUser.staff) {
|
if (currentUser.staff) {
|
||||||
|
if (siteSettings.enable_badges) {
|
||||||
contents.push({
|
contents.push({
|
||||||
icon: 'certificate',
|
icon: 'certificate',
|
||||||
label: 'post.controls.grant_badge',
|
label: 'post.controls.grant_badge',
|
||||||
action: 'grantBadge',
|
action: 'grantBadge',
|
||||||
className: 'grant-badge'
|
className: 'grant-badge'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const action = attrs.locked ? "unlock" : "lock";
|
const action = attrs.locked ? "unlock" : "lock";
|
||||||
contents.push({
|
contents.push({
|
||||||
|
@ -112,7 +114,7 @@ export default createWidget('post-admin-menu', {
|
||||||
const contents = [];
|
const contents = [];
|
||||||
contents.push(h('h3', I18n.t('admin_title')));
|
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));
|
contents.push(this.attach('post-admin-menu-button', b));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue