mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Do not optimize animated images in cooked posts (#11214)
CookedPostProcessor replaces all large images with their optimized versions, but for GIF images the optimized version is limited to first frame only. This caused animations it cooked posts to require a click to show up the lightbox and start playing.
This commit is contained in:
@@ -960,6 +960,19 @@ describe CookedPostProcessor do
|
||||
expect(doc.css('img').first['srcset']).to_not eq(nil)
|
||||
end
|
||||
|
||||
it "does not optimize animated images" do
|
||||
upload.update!(animated: true)
|
||||
post = Fabricate(:post, raw: "")
|
||||
|
||||
cpp = CookedPostProcessor.new(post, disable_loading_image: true)
|
||||
cpp.post_process
|
||||
|
||||
doc = Nokogiri::HTML5::fragment(cpp.html)
|
||||
expect(doc.css('.lightbox-wrapper').size).to eq(1)
|
||||
expect(doc.css('img').first['src']).to include(upload.url)
|
||||
expect(doc.css('img').first['srcset']).to eq(nil)
|
||||
end
|
||||
|
||||
it "optimizes images in quotes" do
|
||||
post = Fabricate(:post, raw: <<~MD)
|
||||
[quote]
|
||||
|
||||
Reference in New Issue
Block a user