claude fix for making the avatars properly get re-fetched if they are newer than the old avatars

This commit is contained in:
2026-04-09 17:44:13 -04:00
parent 2130d85be5
commit d194834110

View File

@@ -62,8 +62,10 @@ defmodule MixerWeb.UploadController do
case AvatarUploader.store({upload, scope}) do
{:ok, _file_name} ->
# The thumb is always stored as avatars/:user_id/thumb.webp
thumb_key = "avatars/#{actor.id}/thumb.webp"
# The thumb is always stored as avatars/:user_id/thumb.webp.
# Append a timestamp so the browser doesn't serve a stale cached image
# when the user updates their avatar (the URL changes, S3 ignores the param).
thumb_key = "avatars/#{actor.id}/thumb.webp?v=#{System.system_time(:millisecond)}"
actor
|> Ash.Changeset.for_update(:update_avatar, %{avatar_url: thumb_key}, actor: actor)