A platform for community discussion. Free, open, simple.
FIX: no error when double save post with poll (#13111)
Krzysztof Kotlarek942b9126a1ba
diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rbindex b5f657f8652..02224aea194 100644--- a/plugins/poll/plugin.rb+++ b/plugins/poll/plugin.rb@@ -467,6 +467,7 @@ after_initialize doafter_save dopolls = self.extracted_polls+ self.extracted_polls = nilnext if polls.blank? || !polls.is_a?(Hash)post = selfdiff --git a/plugins/poll/spec/models/poll_spec.rb b/plugins/poll/spec/models/poll_spec.rbindex 1b1f8e8c7f5..03ebcd2fbe4 100644--- a/plugins/poll/spec/models/poll_spec.rb+++ b/plugins/poll/spec/models/poll_spec.rb@@ -81,6 +81,10 @@ describe ::DiscoursePoll::Poll doexpect(poll.post).to eq(post)end+ end+ it "is not throwing an error when double save" do+ post = Fabricate(:post, raw: "[poll]\n- A\n- B\n[/poll]")+ expect { post.save! }.not_to raise_errorendend