From a932f91c04c4a7c95b3caa50497e1b23969e3db9 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Thu, 15 Sep 2022 22:01:16 +0200 Subject: [PATCH] client: improve error message for empty gallery posts closes https://akkoma.dev/FoundKeyGang/FoundKey/issues/153 Changelog: Fixed --- locales/de-DE.yml | 1 + locales/en-US.yml | 1 + packages/client/src/pages/gallery/edit.vue | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/locales/de-DE.yml b/locales/de-DE.yml index d04480e43..90078ec7d 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -756,6 +756,7 @@ noMaintainerInformationWarning: "Betreiberinformationen sind nicht konfiguriert. noBotProtectionWarning: "Schutz vor Bots ist nicht konfiguriert." configure: "Konfigurieren" postToGallery: "Neuen Galeriebeitrag erstellen" +attachmentRequired: "Mindestens 1 Anhang ist erforderlich." gallery: "Galerie" recentPosts: "Neue Beiträge" popularPosts: "Beliebte Beiträge" diff --git a/locales/en-US.yml b/locales/en-US.yml index db041e692..36a5999ed 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -756,6 +756,7 @@ noMaintainerInformationWarning: "Maintainer information is not configured." noBotProtectionWarning: "Bot protection is not configured." configure: "Configure" postToGallery: "Create new gallery post" +attachmentRequired: "At least 1 attachment is required." gallery: "Gallery" recentPosts: "Recent posts" popularPosts: "Popular posts" diff --git a/packages/client/src/pages/gallery/edit.vue b/packages/client/src/pages/gallery/edit.vue index a6b1015bf..9d567c570 100644 --- a/packages/client/src/pages/gallery/edit.vue +++ b/packages/client/src/pages/gallery/edit.vue @@ -66,6 +66,14 @@ function remove(file) { } async function save() { + if (files.length === 0) { + os.alert({ + type: 'error', + text: i18n.ts.attachmentRequired, + }); + return; + } + if (props.postId) { await os.apiWithDialog('gallery/posts/update', { postId: props.postId,