From 3b8ea90fdc9d1eec475917aac813ed34af399be7 Mon Sep 17 00:00:00 2001
From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
Date: Sun, 7 Jul 2019 14:56:51 +0900
Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=83=BC?=
 =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84?=
 =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=83=80=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0?=
 =?UTF-8?q?=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=81=A7=E7=9F=A5=E3=82=89?=
 =?UTF-8?q?=E3=81=9B=E3=82=8B=20(#5111)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* フォルダーを削除できないときダイアログボックスで知らせる

* https://github.com/syuilo/misskey/pull/5111#issuecomment-508959068

かわいい
---
 locales/ja-JP.yml                                 |  2 ++
 .../app/desktop/views/components/drive.folder.vue | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 32a7fad398..637f2235d6 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -972,6 +972,8 @@ desktop/views/components/drive.folder.vue:
   unable-to-process: "操作を完了できません"
   circular-reference-detected: "移動先のフォルダーは、移動するフォルダーのサブフォルダーです。"
   unhandled-error: "不明なエラー"
+  unable-to-delete: "削除できません"
+  has-child-files-or-folders: "このフォルダは空でないため、削除できません。"
   contextmenu:
     move-to-this-folder: "このフォルダへ移動"
     show-in-new-window: "新しいウィンドウで表示"
diff --git a/src/client/app/desktop/views/components/drive.folder.vue b/src/client/app/desktop/views/components/drive.folder.vue
index fd6de5a05e..bc74ed4317 100644
--- a/src/client/app/desktop/views/components/drive.folder.vue
+++ b/src/client/app/desktop/views/components/drive.folder.vue
@@ -213,6 +213,21 @@ export default Vue.extend({
 		deleteFolder() {
 			this.$root.api('drive/folders/delete', {
 				folderId: this.folder.id
+			}).catch(err => {
+				switch(err.id) {
+					case 'b0fc8a17-963c-405d-bfbc-859a487295e1':
+						this.$root.dialog({
+							type: 'error',
+							title: this.$t('unable-to-delete'),
+							text: this.$t('has-child-files-or-folders')
+						});
+						break;
+					default:
+						this.$root.dialog({
+							type: 'error',
+							text: this.$t('unable-to-delete')
+						});
+				}
 			});
 		}
 	}