mirror of
https://github.com/discourse/discourse.git
synced 2025-09-10 01:42:47 +08:00
FIX: Display large/broken image placeholders for image oneboxes
This commit is contained in:
parent
83bf641292
commit
c499872597
2 changed files with 23 additions and 4 deletions
|
@ -531,6 +531,24 @@ describe CookedPostProcessor do
|
|||
|
||||
expect(cpp.doc.to_s).to eq("<p><img class=\"onebox\" src=\"#{upload.url}\" width=\"\" height=\"\"></p>")
|
||||
end
|
||||
|
||||
it "replaces large image placeholder" do
|
||||
url = 'https://image.com/my-avatar'
|
||||
image_url = 'https://image.com/avatar.png'
|
||||
|
||||
Oneboxer.stubs(:onebox).with(url, anything).returns("<img class='onebox' src='#{image_url}' />")
|
||||
|
||||
post = Fabricate(:post, raw: url)
|
||||
|
||||
post.custom_fields[Post::LARGE_IMAGES] = "[\"//image.com/avatar.png\"]"
|
||||
post.save_custom_fields
|
||||
|
||||
cpp = CookedPostProcessor.new(post, invalidate_oneboxes: true)
|
||||
cpp.post_process_oneboxes
|
||||
cpp.post_process_images
|
||||
|
||||
expect(cpp.doc.to_s).to match(/<div class="large-image-placeholder">/)
|
||||
end
|
||||
end
|
||||
|
||||
context ".post_process_oneboxes removes nofollow if add_rel_nofollow_to_user_content is disabled" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue