Files
fizzy/app/controllers/my/avatars_controller.rb
T
Kevin McConnell eec96ff384 Serve own avatar from its own endpoint
This allows us to have different cache controls depending on whether
you're viewing your own avatar, or someone else's. Your own avatar will
always be fresh, while other folks' avatars can be pulled from the CDN.
2025-12-12 09:03:35 +00:00

17 lines
351 B
Ruby

class My::AvatarsController < ApplicationController
def show
if stale? Current.user
if Current.user.avatar.attached?
redirect_to rails_blob_url(Current.user.avatar_thumbnail, disposition: "inline")
else
render_initials
end
end
end
private
def render_initials
render formats: :svg
end
end