]> git.openstreetmap.org Git - rails.git/commitdiff
Attach resized images to notification emails
authorTom Hughes <tom@compton.nu>
Wed, 13 May 2020 10:29:02 +0000 (11:29 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 13 May 2020 10:29:02 +0000 (11:29 +0100)
Fixes #2625

app/mailers/notifier.rb

index c60dff84b9f0265cfc66137cb5cac3271529e324..10bbb10da7ff51eb673b5621dd99bd842eaf8af2 100644 (file)
@@ -192,7 +192,8 @@ class Notifier < ApplicationMailer
   def user_avatar_file(user)
     avatar = user&.avatar
     if avatar&.attached?
-      avatar.variant(:resize => "50x50>").blob.download
+      image = avatar.variant(:resize => "50x50>").processed
+      image.service.download(image.key)
     else
       File.read(Rails.root.join("app/assets/images/avatar_small.png"))
     end