FIX: Check if plugin disabled globally prior to extending JS
This commit is contained in:
parent
1f938c3f41
commit
16afd2c612
|
@ -141,8 +141,7 @@ function initialize(api) {
|
||||||
api.addUserMenuGlyph(widget => {
|
api.addUserMenuGlyph(widget => {
|
||||||
if (
|
if (
|
||||||
widget.currentUser &&
|
widget.currentUser &&
|
||||||
widget.currentUser.get("staff") &&
|
widget.currentUser.get("staff")
|
||||||
widget.siteSettings.assign_enabled
|
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
label: "discourse_assign.assigned",
|
label: "discourse_assign.assigned",
|
||||||
|
@ -217,6 +216,10 @@ function initialize(api) {
|
||||||
export default {
|
export default {
|
||||||
name: "extend-for-assign",
|
name: "extend-for-assign",
|
||||||
initialize(container) {
|
initialize(container) {
|
||||||
|
const siteSettings = container.lookup("site-settings:main");
|
||||||
|
if (!siteSettings.assign_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
withPluginApi("0.8.11", api => initialize(api, container));
|
withPluginApi("0.8.11", api => initialize(api, container));
|
||||||
withPluginApi("0.8.13", api => modifySelectKit(api, container));
|
withPluginApi("0.8.13", api => modifySelectKit(api, container));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
|
||||||
|
acceptance("Assign (mobile)", {
|
||||||
|
loggedIn: true,
|
||||||
|
mobileView: true,
|
||||||
|
settings: { assign_enabled: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test("Footer dropdown contains button", async assert => {
|
||||||
|
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||||
|
|
||||||
|
await visit("/t/internationalization-localization/280");
|
||||||
|
await menu.expand();
|
||||||
|
|
||||||
|
assert.ok(menu.rowByValue("assign").exists());
|
||||||
|
});
|
||||||
|
|
||||||
|
acceptance("Assign (mobile & disabled)", {
|
||||||
|
loggedIn: true,
|
||||||
|
mobileView: true,
|
||||||
|
settings: { assign_enabled: false },
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test("Footer dropdown does not contain button", async assert => {
|
||||||
|
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||||
|
|
||||||
|
await visit("/t/internationalization-localization/280");
|
||||||
|
await menu.expand();
|
||||||
|
|
||||||
|
assert.notOk(menu.rowByValue("assign").exists());
|
||||||
|
});
|
Loading…
Reference in New Issue