FEATURE: Implement Onebox for posts including polls. (#7539)

This commit is contained in:
Bianca Nenciu
2019-05-29 18:05:52 +03:00
committed by Régis Hanol
parent c77bc525cb
commit 227c45107d
6 changed files with 29 additions and 3 deletions

View File

@ -435,6 +435,13 @@ after_initialize do
end
end
on(:reduce_excerpt) do |doc, options|
post = options[:post]
doc.css("div.poll").each do |poll|
poll.replace "<a href='#{UrlHelper.escape_uri(post.url)}'>#{I18n.t("poll.poll")}</a>"
end
end
on(:post_created) do |post|
DiscoursePoll::Poll.schedule_jobs(post)