From 9ff2d540baf647d3ad310de7b60ff58a4e0ac051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 3 May 2018 10:32:01 +0200 Subject: [PATCH] fix the build --- .../assets/javascripts/lib/discourse-markdown/poll.js.es6 | 1 + plugins/poll/lib/polls_validator.rb | 4 +--- plugins/poll/lib/votes_updater.rb | 2 +- plugins/poll/plugin.rb | 2 +- plugins/poll/spec/lib/pretty_text_spec.rb | 5 +---- 5 files changed, 5 insertions(+), 9 deletions(-) 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 c29e12d9e4a..9168834b920 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 2321f7f0af4..26c8a9c5b01 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 f8a9beac197..ae705d51135 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 f440e33dbce..82efa7fd439 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 fedc70eb986..e01a32d5654 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