From 7d4aed66c7c42cac7deaef4605613058286052d1 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 18 Jul 2016 15:00:12 -0400 Subject: [PATCH] Email Cooker can onebox posts too --- lib/email_cook.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/email_cook.rb b/lib/email_cook.rb index bc1f587944d..f440be6389c 100644 --- a/lib/email_cook.rb +++ b/lib/email_cook.rb @@ -20,7 +20,16 @@ class EmailCook def link_string!(str) str.scan(EmailCook.url_regexp).each do |m| url = m[0] - str.gsub!(url, "#{url}") + + val = "#{url}" + + # Onebox consideration + if str.strip == url + oneboxed = Oneboxer.onebox(url) + val = oneboxed if oneboxed.present? + end + + str.gsub!(url, val) end end