DEV: injects router in customHref/customFilter of addNavigationBarItem (#8018)

DEV: injects router in customHref/customFilter of addNavigationBarItem (#8018)

diff --git a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 b/app/assets/javascripts/discourse/lib/plugin-api.js.es6
index f731ef9..4ecac87 100644
--- a/app/assets/javascripts/discourse/lib/plugin-api.js.es6
+++ b/app/assets/javascripts/discourse/lib/plugin-api.js.es6
@@ -734,7 +734,8 @@ class PluginApi {
    *   name: "link-to-bugs-category",
    *   displayName: "bugs"
    *   href: "/c/bugs",
-   *   customFilter: (category, args) => { category && category.get('name') !== 'bug' }
+   *   customFilter: (category, args, router) => { category && category.name !== 'bug' }
+   *   customHref: (category, args, router) => {  if (category && category.name) === 'not-a-bug') "/a-feature"; }
    * })
    */
   addNavigationBarItem(item) {
@@ -745,6 +746,22 @@ class PluginApi {
         item
       );
     } else {
+      const customHref = item.customHref;
+      if (customHref) {
+        const router = this.container.lookup("service:router");
+        item.customHref = function(category, args) {
+          return customHref(category, args, router);
+        };
+      }
+
+      const customFilter = item.customFilter;
+      if (customFilter) {
+        const router = this.container.lookup("service:router");
+        item.customFilter = function(category, args) {
+          return customFilter(category, args, router);
+        };
+      }
+
       addNavItem(item);
     }
   }

GitHub sha: 6f70138f