fix: Fix issue with profile picture not updating (#10532)

This PR resolves the issue with updating the profile picture in the profile settings.

**Cause of issue**
The issue can be reproduced with the old `ProfileAvatar.vue` component.
While the exact reason is unclear, it seems related to cases where the
file might be `null`.

**Solution**
Replaced the old `ProfileAvatar.vue` with `Avatar.vue` and tested it. It
works fine. I’ve attached a loom video below.

Fixes https://linear.app/chatwoot/issue/CW-3768/profile-picture-bug

Co-authored-by: Pranav <pranav@chatwoot.com>
Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
Sivin Varghese
2024-12-05 04:32:29 +05:30
committed by GitHub
parent bf58a18af4
commit 3edc0542cc
8 changed files with 16 additions and 100 deletions

View File

@@ -190,7 +190,6 @@ export default {
<UserProfilePicture
:src="avatarUrl"
:name="name"
size="72px"
@change="updateProfilePicture"
@delete="deleteProfilePicture"
/>

View File

@@ -1,8 +1,6 @@
<script setup>
import { computed } from 'vue';
import ProfileAvatar from 'v3/components/Form/ProfileAvatar.vue';
import { removeEmoji } from 'shared/helpers/emoji';
const props = defineProps({
import Avatar from 'dashboard/components-next/avatar/Avatar.vue';
defineProps({
src: {
type: String,
default: '',
@@ -15,8 +13,6 @@ const props = defineProps({
const emit = defineEmits(['change', 'delete']);
const userNameWithoutEmoji = computed(() => removeEmoji(props.name));
const updateProfilePicture = e => {
emit('change', e);
};
@@ -31,10 +27,12 @@ const deleteProfilePicture = () => {
<span class="text-sm font-medium text-ash-900">
{{ $t('PROFILE_SETTINGS.FORM.PICTURE') }}
</span>
<ProfileAvatar
:src="src"
:name="userNameWithoutEmoji"
@change="updateProfilePicture"
<Avatar
:src="src || ''"
:name="name || ''"
:size="72"
allow-upload
@upload="updateProfilePicture"
@delete="deleteProfilePicture"
/>
</div>