From a0a064f4c8a3bd8414c953379331668be4f5f2ab Mon Sep 17 00:00:00 2001 From: Danny Liu Date: Mon, 1 Apr 2024 16:23:54 -0700 Subject: [PATCH] update initals avatar if user changes name --- src/lib/components/chat/Settings/Account.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/components/chat/Settings/Account.svelte b/src/lib/components/chat/Settings/Account.svelte index ba33056ec..36d2d6320 100644 --- a/src/lib/components/chat/Settings/Account.svelte +++ b/src/lib/components/chat/Settings/Account.svelte @@ -39,6 +39,11 @@ }; const submitHandler = async () => { + const isInitialsImage: boolean = profileImageUrl === generateInitialsImage($user.name) || profileImageUrl === ''; + if (isInitialsImage && name !== $user.name) { + profileImageUrl = generateInitialsImage(name); + } + const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch( (error) => { toast.error(error);