Commit 6a97759e authored by Robert Speicher's avatar Robert Speicher

Remove ImageLazyLoadFilter from EmailPipeline

parent 0cd1563f
---
title: Image attachments are properly displayed in notification emails again
merge_request: 14161
author:
type: fixed
module Banzai module Banzai
module Filter 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 class ImageLazyLoadFilter < HTML::Pipeline::Filter
def call def call
doc.xpath('descendant-or-self::img').each do |img| doc.xpath('descendant-or-self::img').each do |img|
......
module Banzai module Banzai
module Pipeline module Pipeline
class EmailPipeline < FullPipeline class EmailPipeline < FullPipeline
def self.filters
super.tap do |filter_array|
filter_array.delete(Banzai::Filter::ImageLazyLoadFilter)
end
end
def self.transform_context(context) def self.transform_context(context)
super(context).merge( super(context).merge(
only_path: false 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