From 1d18ccfebd2ffe56ea714e1b955861e331f405db Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 15 May 2023 18:10:15 +0200 Subject: [PATCH] Remove unnecessary sidebar overrides --- .../plugin-manager-initializer.js.es6 | 29 ------------- .../documentation-section-link.js | 42 ------------------- .../plugin-status-section-link.js | 29 ------------- .../community-section/support-section-link.js | 40 ------------------ 4 files changed, 140 deletions(-) delete mode 100644 assets/javascripts/discourse/lib/sidebar/common/community-section/documentation-section-link.js delete mode 100644 assets/javascripts/discourse/lib/sidebar/common/community-section/plugin-status-section-link.js delete mode 100644 assets/javascripts/discourse/lib/sidebar/common/community-section/support-section-link.js diff --git a/assets/javascripts/discourse/initializers/plugin-manager-initializer.js.es6 b/assets/javascripts/discourse/initializers/plugin-manager-initializer.js.es6 index 13fb263..eb4cb60 100644 --- a/assets/javascripts/discourse/initializers/plugin-manager-initializer.js.es6 +++ b/assets/javascripts/discourse/initializers/plugin-manager-initializer.js.es6 @@ -3,12 +3,6 @@ import Discourse from "../models/discourse"; import { withPluginApi } from "discourse/lib/plugin-api"; import discourseComputed from "discourse-common/utils/decorators"; -import EverythingSectionLink from "discourse/lib/sidebar/common/community-section/everything-section-link"; -import AdminSectionLink from "discourse/lib/sidebar/user/community-section/admin-section-link"; -import DocumentationSectionLink from "../lib/sidebar/common/community-section/documentation-section-link"; -import PluginStatusSectionLink from "../lib/sidebar/common/community-section/plugin-status-section-link"; -import SupportSectionLink from "../lib/sidebar/common/community-section/support-section-link"; - export default { name: "plugin-manager", initialize(container) { @@ -68,29 +62,6 @@ export default { return categories.filter((c) => c.for_plugin); }, }); - - api.modifyClass("component:sidebar/user/community-section", { - get defaultMainSectionLinks() { - return [ - EverythingSectionLink, - DocumentationSectionLink, - SupportSectionLink, - PluginStatusSectionLink, - AdminSectionLink, - ]; - }, - }); - - api.modifyClass("component:sidebar/anonymous/community-section", { - get defaultMainSectionLinks() { - return [ - EverythingSectionLink, - DocumentationSectionLink, - SupportSectionLink, - PluginStatusSectionLink, - ]; - }, - }); }); }, }; diff --git a/assets/javascripts/discourse/lib/sidebar/common/community-section/documentation-section-link.js b/assets/javascripts/discourse/lib/sidebar/common/community-section/documentation-section-link.js deleted file mode 100644 index 965ef80..0000000 --- a/assets/javascripts/discourse/lib/sidebar/common/community-section/documentation-section-link.js +++ /dev/null @@ -1,42 +0,0 @@ -import { helperContext } from "discourse-common/lib/helpers"; -import BaseSectionLink from "discourse/lib/sidebar/base-community-section-link"; -import Category from "discourse/models/category"; - -export default class DocumentationSectionLink extends BaseSectionLink { - constructor() { - super(...arguments); - const { site, siteSettings } = helperContext(); - const categoryId = Number( - siteSettings.plugin_manager_documentation_category - ); - this.category = site.categories.find((c) => c.id === categoryId); - } - - get name() { - return "plugin"; - } - - get route() { - return "discovery.category"; - } - - get model() { - return `${Category.slugFor(this.category)}/${this.category?.id}`; - } - - get title() { - return this.category?.name; - } - - get text() { - return this.category?.name; - } - - get prefixType() { - return "icon"; - } - - get prefixValue() { - return "book"; - } -} diff --git a/assets/javascripts/discourse/lib/sidebar/common/community-section/plugin-status-section-link.js b/assets/javascripts/discourse/lib/sidebar/common/community-section/plugin-status-section-link.js deleted file mode 100644 index f1eabb9..0000000 --- a/assets/javascripts/discourse/lib/sidebar/common/community-section/plugin-status-section-link.js +++ /dev/null @@ -1,29 +0,0 @@ -import I18n from "I18n"; - -import BaseSectionLink from "discourse/lib/sidebar/base-community-section-link"; - -export default class PluginStatusSectionLink extends BaseSectionLink { - get name() { - return "plugins"; - } - - get route() { - return "plugins"; - } - - get title() { - return I18n.t("plugin_manager.plugin_status"); - } - - get text() { - return I18n.t("plugin_manager.plugin_status"); - } - - get prefixType() { - return "icon"; - } - - get prefixValue() { - return "plug"; - } -} diff --git a/assets/javascripts/discourse/lib/sidebar/common/community-section/support-section-link.js b/assets/javascripts/discourse/lib/sidebar/common/community-section/support-section-link.js deleted file mode 100644 index 75c2cea..0000000 --- a/assets/javascripts/discourse/lib/sidebar/common/community-section/support-section-link.js +++ /dev/null @@ -1,40 +0,0 @@ -import { helperContext } from "discourse-common/lib/helpers"; -import BaseSectionLink from "discourse/lib/sidebar/base-community-section-link"; -import Category from "discourse/models/category"; - -export default class DocumentationSectionLink extends BaseSectionLink { - constructor() { - super(...arguments); - const { site, siteSettings } = helperContext(); - const categoryId = Number(siteSettings.plugin_manager_support_category); - this.category = site.categories.find((c) => c.id === categoryId); - } - - get name() { - return "plugin"; - } - - get route() { - return "discovery.category"; - } - - get model() { - return `${Category.slugFor(this.category)}/${this.category?.id}`; - } - - get title() { - return this.category?.name; - } - - get text() { - return this.category?.name; - } - - get prefixType() { - return "icon"; - } - - get prefixValue() { - return "far-life-ring"; - } -}