diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rb index ab9c8c3fc81..f8bceebad04 100644 --- a/lib/cooked_post_processor.rb +++ b/lib/cooked_post_processor.rb @@ -22,7 +22,7 @@ class CookedPostProcessor end def post_process_images - images = @doc.search("img") + images = @doc.css("img") - @doc.css(".onebox-result img") return unless images.present? images.each do |img| diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rb index 6ace798c320..6ba31a6ea8a 100644 --- a/spec/components/cooked_post_processor_spec.rb +++ b/spec/components/cooked_post_processor_spec.rb @@ -111,6 +111,21 @@ describe CookedPostProcessor do end end + context 'with a oneboxed image' do + let(:user) { Fabricate(:user) } + let(:topic) { Fabricate(:topic, user: user) } + let(:post) { Fabricate.build(:post_with_oneboxed_image, topic: topic, user: user) } + let(:processor) { CookedPostProcessor.new(post) } + + before do + processor.post_process_images + end + + it "doesn't lightbox" do + processor.html.should_not =~ /class="lightbox"/ + end + end + end context 'link convertor' do diff --git a/spec/fabricators/post_fabricator.rb b/spec/fabricators/post_fabricator.rb index 132a942c559..28bdfa49cef 100644 --- a/spec/fabricators/post_fabricator.rb +++ b/spec/fabricators/post_fabricator.rb @@ -46,6 +46,14 @@ Fabricator(:post_with_uploads, from: :post) do " end +Fabricator(:post_with_oneboxed_image, from: :post) do + cooked " +
+ +
+ " +end + Fabricator(:basic_reply, from: :post) do user(:coding_horror)