DEV: Remove reliance on filterMode URLs

DEV: Remove reliance on filterMode URLs

diff --git a/assets/javascripts/discourse/initializers/discourse-voting.js.es6 b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
index f87ec4f..b31f3a2 100644
--- a/assets/javascripts/discourse/initializers/discourse-voting.js.es6
+++ b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
@@ -1,4 +1,5 @@
 import { withPluginApi } from "discourse/lib/plugin-api";
+import NavItem from "discourse/models/nav-item";
 
 export default {
   name: "discourse-voting",
@@ -14,7 +15,10 @@ export default {
             return category && category.can_vote;
           },
           customHref: (category, args) => {
-            return `${Discourse.BaseUri}/${args.filterMode}?order=votes`;
+            const currentFilterType = (args.filterMode || "").split("/").pop();
+            const path = NavItem.pathFor(currentFilterType, args);
+
+            return `${path}?order=votes`;
           },
           forceActive: (category, args, router) => {
             const queryParams = router.currentRoute.queryParams;

GitHub sha: 3b097f23

2 Likes