Skip to content

A platform for community discussion. Free, open, simple.

FIX: ensure the post url is present

Régis Hanol0df5349dbf36
diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb
index c1fdd157f1e..b9c554240a2 100644
--- a/plugins/poll/plugin.rb
+++ b/plugins/poll/plugin.rb
@@ -438,9 +438,9 @@ after_initialize do
on(:reduce_excerpt) do |doc, options|
post = options[:post]
- replacement = post ?
+ replacement = post&.url.present? ?
"<a href='#{UrlHelper.escape_uri(post.url)}'>#{I18n.t("poll.poll")}</a>" :
- "#{I18n.t("poll.poll")}"
+ I18n.t("poll.poll")
doc.css("div.poll").each do |poll|
poll.replace(replacement)