summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-09-12 11:14:54 -0400
committerRobert Speicher <rspeicher@gmail.com>2017-09-12 11:54:14 -0400
commit6a97759ea86cd6d15eea1b17fd2526b4f0569108 (patch)
tree74d3ff854e59bc400a70bf3783bcfdf51f2e9e48 /lib/banzai
parent0cd1563fb66e9ba533346fe3957912225e27000f (diff)
downloadgitlab-ce-6a97759ea86cd6d15eea1b17fd2526b4f0569108.tar.gz
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/image_lazy_load_filter.rb3
-rw-r--r--lib/banzai/pipeline/email_pipeline.rb6
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/banzai/filter/image_lazy_load_filter.rb b/lib/banzai/filter/image_lazy_load_filter.rb
index bcb4f332267..4cd9b02b76c 100644
--- a/lib/banzai/filter/image_lazy_load_filter.rb
+++ b/lib/banzai/filter/image_lazy_load_filter.rb
@@ -1,6 +1,7 @@
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|
diff --git a/lib/banzai/pipeline/email_pipeline.rb b/lib/banzai/pipeline/email_pipeline.rb
index e47c384afc1..8f5f144d582 100644
--- a/lib/banzai/pipeline/email_pipeline.rb
+++ b/lib/banzai/pipeline/email_pipeline.rb
@@ -1,6 +1,12 @@
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