mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Strip audio/video content from excerpt (#8881)
This commit is contained in:
@@ -340,8 +340,8 @@ module PrettyText
|
||||
doc = Nokogiri::HTML.fragment(html)
|
||||
DiscourseEvent.trigger(:reduce_excerpt, doc, options)
|
||||
strip_image_wrapping(doc)
|
||||
strip_oneboxed_media(doc)
|
||||
html = doc.to_html
|
||||
|
||||
ExcerptParser.get_excerpt(html, max_length, options)
|
||||
end
|
||||
|
||||
@@ -374,6 +374,11 @@ module PrettyText
|
||||
doc.css(".lightbox-wrapper .meta").remove
|
||||
end
|
||||
|
||||
def self.strip_oneboxed_media(doc)
|
||||
doc.css("audio").remove
|
||||
doc.css("video").remove
|
||||
end
|
||||
|
||||
def self.convert_vimeo_iframes(doc)
|
||||
doc.css("iframe[src*='player.vimeo.com']").each do |iframe|
|
||||
if iframe["data-original-href"].present?
|
||||
|
||||
Reference in New Issue
Block a user