FIX: fail to send email notification if post has img tag with no src attribute
This commit is contained in:
parent
cc525b1a8d
commit
eb9f306e64
|
@ -191,8 +191,10 @@ module Email
|
||||||
|
|
||||||
def strip_avatars_and_emojis
|
def strip_avatars_and_emojis
|
||||||
@fragment.search('img').each do |img|
|
@fragment.search('img').each do |img|
|
||||||
|
next unless img['src']
|
||||||
|
|
||||||
if img['src'][/_avatar/]
|
if img['src'][/_avatar/]
|
||||||
img.parent['style'] = "vertical-align: top;" if img.parent.name == 'td'
|
img.parent['style'] = "vertical-align: top;" if img.parent&.name == 'td'
|
||||||
img.remove
|
img.remove
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,13 @@ describe Email::Styles do
|
||||||
style.strip_avatars_and_emojis
|
style.strip_avatars_and_emojis
|
||||||
expect(style.to_html).to match_html("cry_cry")
|
expect(style.to_html).to match_html("cry_cry")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "works if img tag has no attrs" do
|
||||||
|
cooked = "Create a method for click on image and use ng-click in <img> in your slide box...it is simple"
|
||||||
|
style = Email::Styles.new(cooked)
|
||||||
|
style.strip_avatars_and_emojis
|
||||||
|
expect(style.to_html).to eq(cooked)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "onebox_styles" do
|
context "onebox_styles" do
|
||||||
|
|
Loading…
Reference in New Issue