Skip to content

Commit

Permalink
DEV: No need to use call to call these callbacks
Browse files Browse the repository at this point in the history
This is safe because addNavigationBarItem decorates these callbacks,
throwing away the context.
  • Loading branch information
danielwaterworth committed Nov 13, 2019
1 parent 5ff84be commit 60e804a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/assets/javascripts/discourse/models/nav-item.js.es6
Expand Up @@ -164,14 +164,14 @@ NavItem.reopenClass({

const extraItems = NavItem.extraNavItems.filter(item => {
if (!item.customFilter) return true;
return item.customFilter.call(this, category, args);
return item.customFilter(category, args);
});

let forceActive = false;

extraItems.forEach(item => {
if (item.init) {
item.init.call(this, item, category, args);
item.init(item, category, args);
}

const before = item.before;
Expand All @@ -189,9 +189,9 @@ NavItem.reopenClass({

if (!item.customHref) return;

item.set("href", item.customHref.call(this, category, args));
item.set("href", item.customHref(category, args));

if (item.forceActive && item.forceActive.call(this, category, args)) {
if (item.forceActive && item.forceActive(category, args)) {
item.active = true;
forceActive = true;
} else {
Expand Down

0 comments on commit 60e804a

Please sign in to comment.