A platform for community discussion. Free, open, simple.
REFACTOR: Remove `Discourse.SiteSettings` from nav-item
Robin Wardac0d5b1d3fd3
diff --git a/app/assets/javascripts/discourse/app/components/d-navigation.js b/app/assets/javascripts/discourse/app/components/d-navigation.jsindex bb862fd854b..3c4c2d46528 100644--- a/app/assets/javascripts/discourse/app/components/d-navigation.js+++ b/app/assets/javascripts/discourse/app/components/d-navigation.js@@ -79,7 +79,8 @@ export default Component.extend(FilterModeMixin, {return NavItem.buildList(category, {filterType,noSubcategories,- persistedQueryParams: params+ persistedQueryParams: params,+ siteSettings: this.siteSettings});},diff --git a/app/assets/javascripts/discourse/app/controllers/tags-show.js b/app/assets/javascripts/discourse/app/controllers/tags-show.jsindex 55e5d873627..413cc27ba6e 100644--- a/app/assets/javascripts/discourse/app/controllers/tags-show.js+++ b/app/assets/javascripts/discourse/app/controllers/tags-show.js@@ -61,7 +61,8 @@ export default Controller.extend(BulkTopicSelection, FilterModeMixin, {return NavItem.buildList(category, {tagId,filterType,- noSubcategories+ noSubcategories,+ siteSettings: this.siteSettings});},diff --git a/app/assets/javascripts/discourse/app/models/nav-item.js b/app/assets/javascripts/discourse/app/models/nav-item.jsindex 49c0ad37b44..beefa360360 100644--- a/app/assets/javascripts/discourse/app/models/nav-item.js+++ b/app/assets/javascripts/discourse/app/models/nav-item.js@@ -12,9 +12,7 @@ import User from "discourse/models/user";const NavItem = EmberObject.extend({@discourseComputed("name")title(name) {- const extra = {};-- return I18n.t("filters." + name.replace("/", ".") + ".help", extra);+ return I18n.t("filters." + name.replace("/", ".") + ".help", {});},@discourseComputed("name", "count")@@ -195,7 +193,14 @@ NavItem.reopenClass({args.category = category;}- let items = Discourse.SiteSettings.top_menu.split("|");+ if (!args.siteSettings) {+ deprecated("You must supply `buildList` with a `siteSettings` object", {+ since: "2.6.0",+ dropFrom: "2.7.0"+ });+ args.siteSettings = Discourse.SiteSettings;+ }+ let items = args.siteSettings.top_menu.split("|");const filterType = (args.filterMode || "").split("/").pop();@@ -278,18 +283,3 @@ export function customNavItemHref(cb) {export function addNavItem(item) {NavItem.extraNavItemDescriptors.push(item);}--if (typeof Discourse !== "undefined") {- Object.defineProperty(Discourse, "NavItem", {- get() {- deprecated(- "Import the NavItem class instead of using Discourse.NavItem",- {- since: "2.4.0",- dropFrom: "2.5.0"- }- );- return NavItem;- }- });-}diff --git a/app/assets/javascripts/discourse/app/templates/tags/show.hbs b/app/assets/javascripts/discourse/app/templates/tags/show.hbsindex 08b966721ad..e9a0047596f 100644--- a/app/assets/javascripts/discourse/app/templates/tags/show.hbs+++ b/app/assets/javascripts/discourse/app/templates/tags/show.hbs@@ -13,7 +13,6 @@tagId=tag.idnoSubcategories=noSubcategories}}- {{navigation-bar navItems=navItems filterMode=filterMode}}{{else}}<h2 class="tag-show-heading">{{#link-to "tags"}}{{i18n "tagging.tags"}}{{/link-to}}@@ -34,7 +33,7 @@}}{{/unless}}{{/if}}-+{{plugin-outlet name="before-create-topic-button"args=(hashcanCreateTopic=canCreateTopic