Email Cooker can onebox posts too

This commit is contained in:
Robin Ward 2016-07-18 15:00:12 -04:00
parent 12cfc8cedd
commit 7d4aed66c7

View File

@ -20,7 +20,16 @@ class EmailCook
def link_string!(str)
str.scan(EmailCook.url_regexp).each do |m|
url = m[0]
str.gsub!(url, "<a href='#{url}'>#{url}</a>")
val = "<a href='#{url}'>#{url}</a>"
# Onebox consideration
if str.strip == url
oneboxed = Oneboxer.onebox(url)
val = oneboxed if oneboxed.present?
end
str.gsub!(url, val)
end
end