mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-24 16:41:21 +08:00
We used this flag for experimenting with admin plugin sidebars. We have now settled on a tabbed layout, and this is no longer needed. This PR simply ignores the flag in a backwards-compatible way, so we can discontinue usage in plugins and then remove the backwards-compatibility in core.
37 lines
1 KiB
JavaScript
Vendored
37 lines
1 KiB
JavaScript
Vendored
import Controller from "@ember/controller";
|
|
import { service } from "@ember/service";
|
|
import { adminRouteValid } from "discourse/lib/admin-utilities";
|
|
|
|
export default class AdminPluginsController extends Controller {
|
|
@service adminPluginNavManager;
|
|
@service router;
|
|
|
|
get adminRoutes() {
|
|
return this.allAdminRoutes.filter((route) =>
|
|
adminRouteValid(this.router, route)
|
|
);
|
|
}
|
|
|
|
get brokenAdminRoutes() {
|
|
return this.allAdminRoutes.filter(
|
|
(route) => !adminRouteValid(this.router, route)
|
|
);
|
|
}
|
|
|
|
// NOTE: See also AdminPluginsIndexController, there is some duplication here
|
|
// while we convert plugins to use_new_show_route
|
|
get allAdminRoutes() {
|
|
return this.model
|
|
.filter((plugin) => plugin?.enabled && plugin?.adminRoute)
|
|
.map((plugin) => {
|
|
return Object.assign(plugin.adminRoute, { plugin_id: plugin.id });
|
|
});
|
|
}
|
|
|
|
get showTopNav() {
|
|
return (
|
|
!this.adminPluginNavManager.viewingPluginsList &&
|
|
!this.adminPluginNavManager.currentPlugin
|
|
);
|
|
}
|
|
}
|