Fix S3 keys/paths for user avatars
Also fixes the avatars controller to work with all back-ends
This commit is contained in:
@@ -172,14 +172,6 @@ class User < ApplicationRecord
|
||||
Base64.strict_encode64(data)
|
||||
end
|
||||
|
||||
def avatar_filename
|
||||
return nil unless avatar.attached?
|
||||
data = ActiveStorage::Blob.service.download(avatar.key)
|
||||
hash = Digest::SHA256.hexdigest(data)
|
||||
ext = avatar.content_type == "image/png" ? "png" : "jpg"
|
||||
"#{hash}.#{ext}"
|
||||
end
|
||||
|
||||
def avatar_variant(size: :medium)
|
||||
dimensions = case size
|
||||
when :large then [400, 400]
|
||||
|
||||
Reference in New Issue
Block a user