DEV: Remove computed field

DEV: Remove computed field

There was a lot of code for very little functionality and it caused issues with other plugin tests.

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 30c7bb3..840d32f 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
@@ -1,5 +1,3 @@
-import { computed } from "@ember/object";
-import Category from "discourse/models/category";
 import { withPluginApi } from "discourse/lib/plugin-api";
 
 function initialize(api) {
@@ -46,17 +44,5 @@ export default {
   initialize() {
     withPluginApi("0.8.4", api => initialize(api));
     withPluginApi("0.8.30", api => api.addCategorySortCriteria("votes"));
-
-    Category.reopen({
-      enable_topic_voting: computed("custom_fields.enable_topic_voting", {
-        get(enableField) {
-          return enableField;
-        },
-        set(value) {
-          this.set("custom_fields.enable_topic_voting", value);
-          return value;
-        }
-      })
-    });
   }
 };
diff --git a/assets/javascripts/discourse/templates/connectors/category-custom-settings/feature-voting-settings.hbs b/assets/javascripts/discourse/templates/connectors/category-custom-settings/feature-voting-settings.hbs
index a162f20..2d4c229 100644
--- a/assets/javascripts/discourse/templates/connectors/category-custom-settings/feature-voting-settings.hbs
+++ b/assets/javascripts/discourse/templates/connectors/category-custom-settings/feature-voting-settings.hbs
@@ -2,7 +2,7 @@
 <section class='field'>
   <div class="enable-topic-voting">
     <label class="checkbox-label">
-      {{input type="checkbox" checked=category.enable_topic_voting}}
+      {{input type="checkbox" checked=category.custom_fields.enable_topic_voting}}
       {{i18n 'voting.allow_topic_voting'}}
     </label>
   </div>

GitHub sha: 0d4f3840

1 Like