DEV: Define category_custom_field as boolean

DEV: Define category_custom_field as boolean

This removes the need for casting to true/false strings on the client

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 b4bccbf..0ab0b86 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
@@ -53,10 +53,9 @@ export default {
       @computed("custom_fields.enable_topic_voting")
       enable_topic_voting: {
         get(enableField) {
-          return enableField === "true";
+          return enableField;
         },
         set(value) {
-          value = value ? "true" : "false";
           this.set("custom_fields.enable_topic_voting", value);
           return value;
         }
diff --git a/plugin.rb b/plugin.rb
index d6f04aa..1e20c85 100755
--- a/plugin.rb
+++ b/plugin.rb
@@ -22,6 +22,7 @@ after_initialize do
     VOTES = "votes".freeze
     VOTES_ARCHIVE = "votes_archive".freeze
     VOTE_COUNT = "vote_count".freeze
+    VOTING_ENABLED = "enable_topic_voting"
 
     class Engine < ::Rails::Engine
       isolate_namespace DiscourseVoting
@@ -31,6 +32,7 @@ after_initialize do
   User.register_custom_field_type(::DiscourseVoting::VOTES, [:integer])
   User.register_custom_field_type(::DiscourseVoting::VOTES_ARCHIVE, [:integer])
   Topic.register_custom_field_type(::DiscourseVoting::VOTE_COUNT, :integer)
+  Category.register_custom_field_type(::DiscourseVoting::VOTING_ENABLED, :boolean)
 
   load File.expand_path('../app/jobs/onceoff/voting_ensure_consistency.rb', __FILE__)
 
@@ -95,7 +97,7 @@ after_initialize do
         begin
           Set.new(
             CategoryCustomField
-            .where(name: "enable_topic_voting", value: "true")
+            .where(name: ::DiscourseVoting::VOTING_ENABLED, value: "true")
             .pluck(:category_id)
           )
         end

GitHub sha: 9e61d300