From eb3c8ccce8562126534ef2c216834438b831f1b6 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sat, 7 Jan 2023 17:17:18 +0000 Subject: [PATCH] Send avatar/banner media type to server when updating profile info --- CHANGELOG.md | 1 + src/api/users.ts | 2 ++ src/views/ProfileForm.vue | 3 +++ 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58cabe1..bf428ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Added `/@username` routes for profile pages. - Allowed to attach image from clipboard. - Started using media limits provided by the backend. +- Send avatar and banner media types to server when updating profile info. ### Changed diff --git a/src/api/users.ts b/src/api/users.ts index ba1f52a..da7afba 100644 --- a/src/api/users.ts +++ b/src/api/users.ts @@ -233,7 +233,9 @@ export interface ProfileUpdateData { display_name: string | null; note: string | null; avatar: string | null; + avatar_media_type: string | null; header: string | null; + header_media_type: string | null; fields_attributes: ProfileFieldAttrs[]; } diff --git a/src/views/ProfileForm.vue b/src/views/ProfileForm.vue index 8a0734f..f196275 100644 --- a/src/views/ProfileForm.vue +++ b/src/views/ProfileForm.vue @@ -125,7 +125,9 @@ const form = $ref({ note: profile.source.note, fields_attributes: getFieldsAttributes(), avatar: null, + avatar_media_type: null, header: null, + header_media_type: null, }) const images = $ref({ avatar: profile.avatar, @@ -165,6 +167,7 @@ async function onFilePicked(fieldName: "avatar" | "header", event: Event) { images[fieldName] = imageDataUrl const imageData = dataUrlToBase64(imageDataUrl) form[fieldName] = imageData.data + form[`${fieldName}_media_type`] = imageData.mediaType } function isValidExtraField(index: number): boolean {