eec96ff384
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.
17 lines
351 B
Ruby
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
|