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

This commit is contained in:
Robin Ward 2020-07-21 12:19:45 -04:00
parent 9dd6367d81
commit ac0d5b1d3f
4 changed files with 14 additions and 23 deletions

View File

@ -79,7 +79,8 @@ export default Component.extend(FilterModeMixin, {
return NavItem.buildList(category, {
filterType,
noSubcategories,
persistedQueryParams: params
persistedQueryParams: params,
siteSettings: this.siteSettings
});
},

View File

@ -61,7 +61,8 @@ export default Controller.extend(BulkTopicSelection, FilterModeMixin, {
return NavItem.buildList(category, {
tagId,
filterType,
noSubcategories
noSubcategories,
siteSettings: this.siteSettings
});
},

View File

@ -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;
}
});
}

View File

@ -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