diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 3dccac678..4e409d0ff 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -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 }, diff --git a/app/views/mailers/notification/bundle_mailer/_notification.html.erb b/app/views/mailers/notification/bundle_mailer/_notification.html.erb index 5dfddcf31..0d5d00d70 100644 --- a/app/views/mailers/notification/bundle_mailer/_notification.html.erb +++ b/app/views/mailers/notification/bundle_mailer/_notification.html.erb @@ -1,6 +1,6 @@
| <%= image_tag user_avatar_url(notification.creator), alt: notification.creator.name, class: "avatar", size: 48 %> | +<%= mail_avatar_tag(notification.creator) %> | <%= render "notification/bundle_mailer/header", notification: notification %> <%= render "notification/bundle_mailer/#{notification.source_type.underscore}/body", notification: notification %> diff --git a/test/mailers/previews/notification/bundle_mailer_preview.rb b/test/mailers/previews/notification/bundle_mailer_preview.rb index 3c279e916..9242aaa60 100644 --- a/test/mailers/previews/notification/bundle_mailer_preview.rb +++ b/test/mailers/previews/notification/bundle_mailer_preview.rb @@ -1,6 +1,5 @@ class Notification::BundleMailerPreview < ActionMailer::Preview def notification - ApplicationRecord.current_tenant = "1065895976" Notification::BundleMailer.notification Notification::Bundle.take! end end |