Merge branch 'main' into testE2E-timezone
This commit is contained in:
commit
de2d40b129
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@calcom/web",
|
||||
"version": "3.5.1",
|
||||
"version": "3.5.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"analyze": "ANALYZE=true next build",
|
||||
|
|
|
@ -61,6 +61,8 @@ export const updateProfileHandler = async ({ ctx, input }: UpdateProfileOptions)
|
|||
const userMetadata = handleUserMetadata({ ctx, input });
|
||||
const data: Prisma.UserUpdateInput = {
|
||||
...input,
|
||||
// DO NOT OVERWRITE AVATAR.
|
||||
avatar: undefined,
|
||||
metadata: userMetadata,
|
||||
};
|
||||
|
||||
|
@ -138,14 +140,21 @@ export const updateProfileHandler = async ({ ctx, input }: UpdateProfileOptions)
|
|||
// when the email changes, the user needs to sign in again.
|
||||
signOutUser = true;
|
||||
}
|
||||
// don't do anything if avatar is undefined.
|
||||
if (typeof input.avatar !== "undefined") {
|
||||
data.avatarUrl = input.avatar
|
||||
? await uploadAvatar({
|
||||
avatar: await resizeBase64Image(input.avatar),
|
||||
userId: user.id,
|
||||
})
|
||||
: null;
|
||||
// if defined AND a base 64 string, upload and set the avatar URL
|
||||
if (input.avatar && input.avatar.startsWith("data:image/png;base64,")) {
|
||||
const avatar = await resizeBase64Image(input.avatar);
|
||||
data.avatarUrl = await uploadAvatar({
|
||||
avatar,
|
||||
userId: user.id,
|
||||
});
|
||||
// as this is still used in the backwards compatible endpoint, we also write it here
|
||||
// to ensure no data loss.
|
||||
data.avatar = avatar;
|
||||
}
|
||||
// Unset avatar url if avatar is empty string.
|
||||
if ("" === input.avatar) {
|
||||
data.avatarUrl = null;
|
||||
data.avatar = null;
|
||||
}
|
||||
|
||||
const updatedUser = await prisma.user.update({
|
||||
|
|
Loading…
Reference in New Issue
Block a user