Commit 9c9b1774 authored by Douwe Maan's avatar Douwe Maan

Merge branch...

Merge branch '37629-lazy-image-loading-breaks-notification-mails-for-an-added-screenshot' into 'master'

Resolve "Lazy image loading breaks notification mails for an added screenshot"

Closes #37629

See merge request !14161
parents 3278681d 6a97759e
---
title: Image attachments are properly displayed in notification emails again
merge_request: 14161
author:
type: fixed
module Banzai
module Filter
# HTML filter that moves the value of the src attribute to the data-src attribute so it can be lazy loaded
# HTML filter that moves the value of image `src` attributes to `data-src`
# so they can be lazy loaded.
class ImageLazyLoadFilter < HTML::Pipeline::Filter
def call
doc.xpath('descendant-or-self::img').each do |img|
......
module Banzai
module Pipeline
class EmailPipeline < FullPipeline
def self.filters
super.tap do |filter_array|
filter_array.delete(Banzai::Filter::ImageLazyLoadFilter)
end
end
def self.transform_context(context)
super(context).merge(
only_path: false
......
require 'rails_helper'
describe Banzai::Pipeline::EmailPipeline do
describe '.filters' do
it 'returns the expected type' do
expect(described_class.filters).to be_kind_of(Banzai::FilterArray)
end
it 'excludes ImageLazyLoadFilter' do
expect(described_class.filters).not_to be_empty
expect(described_class.filters).not_to include(Banzai::Filter::ImageLazyLoadFilter)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment