From 9ca36021b05b448f969568fa6cb1118b70cb4230 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Wed, 17 Jul 2019 13:28:27 +0900 Subject: [PATCH] Fix #5172 (#5174) --- locales/ja-JP.yml | 4 ++++ .../views/components/settings/profile.vue | 23 +++++++++++++++++++ src/client/app/desktop/api/update-avatar.ts | 15 ++++++++++++ src/client/app/desktop/api/update-banner.ts | 15 ++++++++++++ 4 files changed, 57 insertions(+) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 3e315153c..1c3f22dc2 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -782,6 +782,9 @@ common/views/components/profile-editor.vue: saved: "プロフィールを保存しました" uploading: "アップロード中" upload-failed: "アップロードに失敗しました" + unable-to-process: "操作を完了できません" + avatar-not-an-image: "アイコンとして指定したファイルは画像ではありません" + banner-not-an-image: "バナーとして指定したファイルは画像ではありません" email: "メール設定" email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" @@ -927,6 +930,7 @@ desktop: uploading-avatar: "新しいアバターをアップロードしています" avatar-updated: "アバターを更新しました" choose-avatar: "アバターにする画像を選択" + unable-to-process: "操作を完了できません" invalid-filetype: "この形式のファイルはサポートされていません" desktop/views/components/activity.chart.vue: diff --git a/src/client/app/common/views/components/settings/profile.vue b/src/client/app/common/views/components/settings/profile.vue index a22fd6df9..52ec8ceda 100644 --- a/src/client/app/common/views/components/settings/profile.vue +++ b/src/client/app/common/views/components/settings/profile.vue @@ -265,6 +265,29 @@ export default Vue.extend({ text: this.$t('saved') }); } + }).catch(err => { + this.saving = false; + switch(err.id) { + case 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191': + this.$root.dialog({ + type: 'error', + title: this.$t('unable-to-process'), + text: this.$t('avatar-not-an-image') + }); + break; + case '75aedb19-2afd-4e6d-87fc-67941256fa60': + this.$root.dialog({ + type: 'error', + title: this.$t('unable-to-process'), + text: this.$t('banner-not-an-image') + }); + break; + default: + this.$root.dialog({ + type: 'error', + text: this.$t('unable-to-process') + }); + } }); }, diff --git a/src/client/app/desktop/api/update-avatar.ts b/src/client/app/desktop/api/update-avatar.ts index a095491b6..dad720827 100644 --- a/src/client/app/desktop/api/update-avatar.ts +++ b/src/client/app/desktop/api/update-avatar.ts @@ -83,6 +83,21 @@ export default ($root: any) => { }); return i; + }).catch(err => { + switch(err.id) { + case 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191': + $root.dialog({ + type: 'error', + title: locale['desktop']['unable-to-process'], + text: locale['desktop']['invalid-filetype'] + }); + break; + default: + $root.dialog({ + type: 'error', + text: locale['desktop']['unable-to-process'] + }); + } }); }; diff --git a/src/client/app/desktop/api/update-banner.ts b/src/client/app/desktop/api/update-banner.ts index c23a32536..79d130f94 100644 --- a/src/client/app/desktop/api/update-banner.ts +++ b/src/client/app/desktop/api/update-banner.ts @@ -83,6 +83,21 @@ export default ($root: any) => { }); return i; + }).catch(err => { + switch(err.id) { + case '75aedb19-2afd-4e6d-87fc-67941256fa60': + $root.dialog({ + type: 'error', + title: locale['desktop']['unable-to-process'], + text: locale['desktop']['invalid-filetype'] + }); + break; + default: + $root.dialog({ + type: 'error', + text: locale['desktop']['unable-to-process'] + }); + } }); };