REFACTOR: Remove `Discourse.SiteSettings` from nav-item

REFACTOR: Remove Discourse.SiteSettings from nav-item

diff --git a/app/assets/javascripts/discourse/app/components/d-navigation.js b/app/assets/javascripts/discourse/app/components/d-navigation.js
index bb862fd..3c4c2d4 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.js
index 55e5d87..413cc27 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.js
index 49c0ad3..beefa36 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.hbs
index 08b9667..e9a0047 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.id
             noSubcategories=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=(hash
             canCreateTopic=canCreateTopic

GitHub sha: ac0d5b1d

This commit appears in #10280 which was merged by eviltrout.