diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index b5f657f8652..02224aea194 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -467,6 +467,7 @@ after_initialize do after_save do polls = self.extracted_polls + self.extracted_polls = nil next if polls.blank? || !polls.is_a?(Hash) post = self diff --git a/plugins/poll/spec/models/poll_spec.rb b/plugins/poll/spec/models/poll_spec.rb index 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 do expect(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_error end end