A platform for community discussion. Free, open, simple.
FIX: update post voting for new JSON encoding (#39206)
Kris871dd2da01e7
diff --git a/plugins/discourse-post-voting/plugin.rb b/plugins/discourse-post-voting/plugin.rbindex 990fa46c9d3..0749cd76d81 100644--- a/plugins/discourse-post-voting/plugin.rb+++ b/plugins/discourse-post-voting/plugin.rb@@ -184,7 +184,7 @@ after_initialize doTopicSubtype.register(Topic::POST_VOTING_SUBTYPE)NewPostManager.add_handler do |manager|- if !manager.args[:topic_id] && manager.args[:create_as_post_voting] == "true" &&+ if !manager.args[:topic_id] && manager.args[:create_as_post_voting].to_s == "true" &&(manager.args[:archetype].blank? || manager.args[:archetype] == Archetype.default)manager.args[:subtype] = Topic::POST_VOTING_SUBTYPEenddiff --git a/plugins/discourse-post-voting/spec/requests/posts_controller_spec.rb b/plugins/discourse-post-voting/spec/requests/posts_controller_spec.rbindex d926cee772a..bb9ebf5b347 100644--- a/plugins/discourse-post-voting/spec/requests/posts_controller_spec.rb+++ b/plugins/discourse-post-voting/spec/requests/posts_controller_spec.rb@@ -15,6 +15,9 @@ describe PostsController doraw: "this is some raw",title: "this is some title",create_as_post_voting: true,+ }.to_json,+ headers: {+ "CONTENT_TYPE" => "application/json",}expect(response.status).to eq(200)@@ -33,6 +36,9 @@ describe PostsController docreate_as_post_voting: true,archetype: Archetype.private_message,target_recipients: user.username,+ }.to_json,+ headers: {+ "CONTENT_TYPE" => "application/json",}expect(response.status).to eq(200)