FIX: don't use emojis as topic image

This commit is contained in:
Régis Hanol 2015-08-05 12:57:31 +02:00
parent b8c8348e5b
commit 82d743a052
3 changed files with 6 additions and 3 deletions

View File

@ -66,6 +66,8 @@ class CookedPostProcessor
@doc.css("img[src]") -
# minus, data images
@doc.css("img[src^='data']") -
# minus, emojis
@doc.css("img.emoji") -
# minus, image inside oneboxes
oneboxed_images -
# minus, images inside quotes

View File

@ -173,10 +173,10 @@ describe CookedPostProcessor do
context ".extract_images" do
let(:post) { build(:post_with_images_in_quote_and_onebox) }
let(:post) { build(:post_with_plenty_of_images) }
let(:cpp) { CookedPostProcessor.new(post) }
it "does not extract images inside oneboxes or quotes" do
it "does not extract emojis or images inside oneboxes or quotes" do
expect(cpp.extract_images.length).to eq(0)
end

View File

@ -42,11 +42,12 @@ Fabricator(:reply, from: :post) do
'
end
Fabricator(:post_with_images_in_quote_and_onebox, from: :post) do
Fabricator(:post_with_plenty_of_images, from: :post) do
cooked '
<aside class="quote"><img src="/uploads/default/1/1234567890123456.jpg"></aside>
<div class="onebox-result"><img src="/uploads/default/1/1234567890123456.jpg"></div>
<div class="onebox"><img src="/uploads/default/1/1234567890123456.jpg"></div>
<p>With an emoji! <img src="//cdn.discourse.org/meta/images/emoji/twitter/smile.png?v=0" title=":smile:" class="emoji" alt="smile" width="72" height="72"></p>
'
end