diff --git a/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 b/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 index c29e12d9e4..9168834b92 100644 --- a/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 +++ b/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 @@ -197,6 +197,7 @@ const rule = { state.push('poll_close', 'div', -1); state.push('poll_close', 'div', -1); + state.push('poll_close', 'div', -1); } }; diff --git a/plugins/poll/lib/polls_validator.rb b/plugins/poll/lib/polls_validator.rb index 2321f7f0af..26c8a9c5b0 100644 --- a/plugins/poll/lib/polls_validator.rb +++ b/plugins/poll/lib/polls_validator.rb @@ -7,9 +7,7 @@ module DiscoursePoll def validate_polls polls = {} - extracted_polls = DiscoursePoll::Poll::extract(@post.raw, @post.topic_id, @post.user_id) - - extracted_polls.each do |poll| + DiscoursePoll::Poll::extract(@post.raw, @post.topic_id, @post.user_id).each do |poll| # polls should have a unique name return false unless unique_poll_name?(polls, poll) diff --git a/plugins/poll/lib/votes_updater.rb b/plugins/poll/lib/votes_updater.rb index f8a9beac19..ae705d5113 100644 --- a/plugins/poll/lib/votes_updater.rb +++ b/plugins/poll/lib/votes_updater.rb @@ -6,7 +6,7 @@ module DiscoursePoll .pluck(:post_id) post_ids.each do |post_id| - DistributedMutex.synchronize("#{DiscoursePoll::MUTEX_PREFIX}-#{post_id}") do + DistributedMutex.synchronize("discourse_poll-#{post_id}") do post = Post.find_by(id: post_id) update_votes(post, source_user, target_user) if post end diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index f440e33dbc..82efa7fd43 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -171,7 +171,7 @@ after_initialize do cooked = PrettyText.cook(raw, topic_id: topic_id, user_id: user_id) Nokogiri::HTML(cooked).css("div.poll").map do |p| - poll = { "options" => [], "voters" => 0 } + poll = { "options" => [], "voters" => 0, "name" => DiscoursePoll::DEFAULT_POLL_NAME } # attributes p.attributes.values.each do |attribute| diff --git a/plugins/poll/spec/lib/pretty_text_spec.rb b/plugins/poll/spec/lib/pretty_text_spec.rb index fedc70eb98..e01a32d565 100644 --- a/plugins/poll/spec/lib/pretty_text_spec.rb +++ b/plugins/poll/spec/lib/pretty_text_spec.rb @@ -106,13 +106,10 @@ describe PrettyText do

0 - voters + voters

-
- Show results -
MD