FIX: prevents any work if not enabled

FIX: prevents any work if not enabled

diff --git a/assets/javascripts/discourse/initializers/discourse-voting.js.es6 b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
index ea6141b..5accead 100644
--- a/assets/javascripts/discourse/initializers/discourse-voting.js.es6
+++ b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
@@ -5,25 +5,18 @@ export default {
 
   initialize() {
     withPluginApi("0.8.32", api => {
-      api.addNavigationBarItem({
-        name: "votes",
-        customFilter: category => {
-          const container = api.container;
-
-          if (
-            container &&
-            (!container.isDestroying || !container.isDestroyed)
-          ) {
-            const siteSettings = container.lookup("site-settings:main");
-            return siteSettings.voting_enabled && category && category.can_vote;
+      const siteSettings = api.container.lookup("site-settings:main");
+      if (siteSettings.voting_enabled) {
+        api.addNavigationBarItem({
+          name: "votes",
+          customFilter: category => {
+            return category && category && category.can_vote;
+          },
+          customHref: (category, args) => {
+            return `${Discourse.BaseUri}/${args.filterMode}?order=votes`;
           }
-
-          return false;
-        },
-        customHref: (category, args) => {
-          return `${Discourse.BaseUri}/${args.filterMode}?order=votes`;
-        }
-      });
+        });
+      }
     });
   }
 };

GitHub sha: 315730fa

1 Like