mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
DEV: Refactor excluding audio/video URLs from search result blurbs
Followup to 580a4a82
This commit is contained in:
@ -80,8 +80,12 @@ class Search
|
||||
cooked.scan(URI.regexp(%w{http https})) { urls << $& }
|
||||
|
||||
urls.each do |url|
|
||||
cooked.gsub!(url, I18n.t("search.video")) if url.match(/.(mov|mp4|webm|ogv)/)
|
||||
cooked.gsub!(url, I18n.t("search.audio")) if url.match(/.(mp3|ogg|wav|m4a)/)
|
||||
case File.extname(URI(url).path || "")
|
||||
when Oneboxer::VIDEO_REGEX
|
||||
cooked.gsub!(url, I18n.t("search.video"))
|
||||
when Oneboxer::AUDIO_REGEX
|
||||
cooked.gsub!(url, I18n.t("search.audio"))
|
||||
end
|
||||
end
|
||||
|
||||
if term
|
||||
|
Reference in New Issue
Block a user