DEV: Remove extraneous intermediates

This commit is contained in:
Daniel Waterworth 2019-11-13 13:57:01 +00:00
parent 13c5381027
commit e00ec22582
1 changed files with 4 additions and 7 deletions

View File

@ -116,9 +116,7 @@ NavItem.reopenClass({
if (!Discourse.Site.currentProp("top_menu_items").includes(testName))
return null;
var args = { name: name, hasIcon: name === "unread" },
extra = null,
self = this;
var args = { name: name, hasIcon: name === "unread" };
if (opts.category) {
args.category = opts.category;
}
@ -131,10 +129,9 @@ NavItem.reopenClass({
if (opts.noSubcategories) {
args.noSubcategories = true;
}
NavItem.extraArgsCallbacks.forEach(cb => {
extra = cb.call(self, text, opts);
_.merge(args, extra);
});
NavItem.extraArgsCallbacks.forEach(cb =>
_.merge(args, cb.call(this, text, opts))
);
const store = Discourse.__container__.lookup("service:store");
return store.createRecord("nav-item", args);