DEV: moves back part of initializer in pre-initializer

DEV: moves back part of initializer in pre-initializer

diff --git a/assets/javascripts/discourse/initializers/discourse-voting.js.es6 b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
index 50871aa..e3dd7de 100644
--- a/assets/javascripts/discourse/initializers/discourse-voting.js.es6
+++ b/assets/javascripts/discourse/initializers/discourse-voting.js.es6
@@ -1,47 +1,9 @@
 import { withPluginApi } from "discourse/lib/plugin-api";
 
-function initialize(api) {
-  api.addPostClassesCallback(post => {
-    if (post.post_number === 1 && post.can_vote) {
-      return ["voting-post"];
-    }
-  });
-  api.includePostAttributes("can_vote");
-  api.addTagsHtmlCallback(
-    topic => {
-      if (!topic.can_vote) {
-        return;
-      }
-
-      var buffer = [];
-
-      let title = "";
-      if (topic.user_voted) {
-        title = ` title='${I18n.t("voting.voted")}'`;
-      }
-
-      let userVotedClass = topic.user_voted ? " voted" : "";
-      buffer.push(
-        `<span class='list-vote-count discourse-tag${userVotedClass}'${title}>`
-      );
-
-      buffer.push(I18n.t("voting.votes", { count: topic.vote_count }));
-      buffer.push("</span>");
-
-      if (buffer.length > 0) {
-        return buffer.join("");
-      }
-    },
-    { priority: -100 }
-  );
-}
-
 export default {
   name: "discourse-voting",
 
   initialize(api) {
-    withPluginApi("0.8.4", api => initialize(api));
-    withPluginApi("0.8.30", api => api.addCategorySortCriteria("votes"));
     withPluginApi("0.8.32", api => {
       api.addNavigationBarItem({
         name: "votes",
diff --git a/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6 b/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6
index c2a94e8..f8763e4 100644
--- a/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6
+++ b/assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6
@@ -2,12 +2,51 @@ import computed from "ember-addons/ember-computed-decorators";
 import Category from "discourse/models/category";
 import { withPluginApi } from "discourse/lib/plugin-api";
 
+function initialize(api) {
+  api.addPostClassesCallback(post => {
+    if (post.post_number === 1 && post.can_vote) {
+      return ["voting-post"];
+    }
+  });
+  api.includePostAttributes("can_vote");
+  api.addTagsHtmlCallback(
+    topic => {
+      if (!topic.can_vote) {
+        return;
+      }
+
+      var buffer = [];
+
+      let title = "";
+      if (topic.user_voted) {
+        title = ` title='${I18n.t("voting.voted")}'`;
+      }
+
+      let userVotedClass = topic.user_voted ? " voted" : "";
+      buffer.push(
+        `<span class='list-vote-count discourse-tag${userVotedClass}'${title}>`
+      );
+
+      buffer.push(I18n.t("voting.votes", { count: topic.vote_count }));
+      buffer.push("</span>");
+
+      if (buffer.length > 0) {
+        return buffer.join("");
+      }
+    },
+    { priority: -100 }
+  );
+}
+
 export default {
   name: "extend-category-for-voting",
 
   before: "inject-discourse-objects",
 
-  initialize() {
+  initialize(api) {
+    withPluginApi("0.8.4", api => initialize(api));
+    withPluginApi("0.8.30", api => api.addCategorySortCriteria("votes"));
+
     Category.reopen({
       @computed("custom_fields.enable_topic_voting")
       enable_topic_voting: {

GitHub sha: 335b613e