mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
PERF: Move oneboxing from cook method "email" to postprocessing
This commit is contained in:
parent
d3003592cd
commit
1481462cbf
2 changed files with 12 additions and 11 deletions
|
@ -21,12 +21,11 @@ class EmailCook
|
|||
str.scan(EmailCook.url_regexp).each do |m|
|
||||
url = m[0]
|
||||
|
||||
val = "<a href='#{url}'>#{url}</a>"
|
||||
|
||||
# Onebox consideration
|
||||
if str.strip == url
|
||||
oneboxed = Oneboxer.onebox(url)
|
||||
val = oneboxed if oneboxed.present?
|
||||
# this could be oneboxed
|
||||
val = %|<a href="#{url}" class="onebox" target="_blank">#{url}</a>|
|
||||
else
|
||||
val = %|<a href="#{url}">#{url}</a>|
|
||||
end
|
||||
|
||||
str.gsub!(url, val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue