Problem
When a user uploads a custom avatar and later signs in with Google OAuth, Supabase overwrites user_metadata.avatar_url with the Google profile picture. The custom avatar is lost.
Proposed Fix
Store custom avatars in a separate metadata field (custom_avatar_url). Prefer it over the Google-provided avatar_url when displaying.
Frontend
- Profile page: write uploaded avatar to
custom_avatar_url instead of avatar_url
- Layout.astro: read
custom_avatar_url ?? avatar_url for display
Backend
- HttpContextCurrentUserAccessor: check
custom_avatar_url first, fall back to avatar_url
- SupabaseUserInfoService: same precedence
Files involved
frontend/src/pages/[...lang]/profile.astro — avatar upload
frontend/src/layouts/Layout.astro — avatar display
backend/src/Kalandra.Api/Infrastructure/Auth/HttpContextCurrentUserAccessor.cs — JWT extraction
backend/src/Kalandra.Infrastructure/Users/SupabaseUserInfoService.cs — admin API fetch
Problem
When a user uploads a custom avatar and later signs in with Google OAuth, Supabase overwrites
user_metadata.avatar_urlwith the Google profile picture. The custom avatar is lost.Proposed Fix
Store custom avatars in a separate metadata field (
custom_avatar_url). Prefer it over the Google-providedavatar_urlwhen displaying.Frontend
custom_avatar_urlinstead ofavatar_urlcustom_avatar_url ?? avatar_urlfor displayBackend
custom_avatar_urlfirst, fall back toavatar_urlFiles involved
frontend/src/pages/[...lang]/profile.astro— avatar uploadfrontend/src/layouts/Layout.astro— avatar displaybackend/src/Kalandra.Api/Infrastructure/Auth/HttpContextCurrentUserAccessor.cs— JWT extractionbackend/src/Kalandra.Infrastructure/Users/SupabaseUserInfoService.cs— admin API fetch