FIX: ensure the post url is present

Also don't interpolate a string
This commit is contained in:
Régis Hanol 2019-05-30 00:05:53 +02:00 committed by GitHub
parent a188d15b08
commit 0df5349dbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)