Don't render SVG avatars in emails since mail services won't render them
https://app.fizzy.do/5986089/cards/1740
This commit is contained in:
@@ -19,6 +19,16 @@ module AvatarsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def mail_avatar_tag(user, size: 48, **options)
|
||||
if user.avatar.attached?
|
||||
image_tag user_avatar_url(notification.creator), alt: notification.creator.name, class: "avatar", **options
|
||||
else
|
||||
tag.span class: "avatar" do
|
||||
user.initials
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def avatar_preview_tag(user, hidden_for_screen_reader: false, **options)
|
||||
tag.span class: class_names("avatar", options.delete(:class)),
|
||||
aria: { hidden: hidden_for_screen_reader, label: user.name },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<table class="notification">
|
||||
<tr>
|
||||
<td class="avatar__container"><%= image_tag user_avatar_url(notification.creator), alt: notification.creator.name, class: "avatar", size: 48 %></td>
|
||||
<td class="avatar__container"><%= mail_avatar_tag(notification.creator) %></td>
|
||||
<td>
|
||||
<%= render "notification/bundle_mailer/header", notification: notification %>
|
||||
<%= render "notification/bundle_mailer/#{notification.source_type.underscore}/body", notification: notification %>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Notification::BundleMailerPreview < ActionMailer::Preview
|
||||
def notification
|
||||
ApplicationRecord.current_tenant = "1065895976"
|
||||
Notification::BundleMailer.notification Notification::Bundle.take!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user