From a188d15b08dac322c074b4ee9de6269ec6cc3fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 30 May 2019 00:02:33 +0200 Subject: [PATCH] FIX: reduce poll when post is nil --- plugins/poll/plugin.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index 4a494cf4c5b..c1fdd157f1e 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -437,8 +437,13 @@ after_initialize do on(:reduce_excerpt) do |doc, options| post = options[:post] + + replacement = post ? + "#{I18n.t("poll.poll")}" : + "#{I18n.t("poll.poll")}" + doc.css("div.poll").each do |poll| - poll.replace "#{I18n.t("poll.poll")}" + poll.replace(replacement) end end