From 97002400a8d59fc8a7a9810e9edadc849685dd5d Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Thu, 4 Jul 2019 14:31:30 +0900
Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=90=E3=82=BF=E3=83=BC=E3=83=95?=
 =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E9=81=B8=E6=8A=9E=E3=81=A7image?=
 =?UTF-8?q?=E4=BB=A5=E5=A4=96=E3=81=AF=E8=A1=A8=E7=A4=BA=E3=81=97=E3=81=AA?=
 =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=20(#5098)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/client/app/desktop/api/update-avatar.ts                | 1 +
 src/client/app/desktop/api/update-banner.ts                | 1 +
 src/client/app/desktop/script.ts                           | 1 +
 .../views/components/choose-file-from-drive-window.vue     | 6 ++++++
 src/client/app/desktop/views/components/drive.vue          | 7 +++++++
 .../app/mobile/views/components/drive-file-chooser.vue     | 3 ++-
 6 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/client/app/desktop/api/update-avatar.ts b/src/client/app/desktop/api/update-avatar.ts
index e2da55fc97..a095491b69 100644
--- a/src/client/app/desktop/api/update-avatar.ts
+++ b/src/client/app/desktop/api/update-avatar.ts
@@ -91,6 +91,7 @@ export default ($root: any) => {
 			? Promise.resolve(file)
 			: $root.$chooseDriveFile({
 				multiple: false,
+				type: 'image/*',
 				title: locale['desktop']['choose-avatar']
 			});
 
diff --git a/src/client/app/desktop/api/update-banner.ts b/src/client/app/desktop/api/update-banner.ts
index e62277338d..c23a325364 100644
--- a/src/client/app/desktop/api/update-banner.ts
+++ b/src/client/app/desktop/api/update-banner.ts
@@ -91,6 +91,7 @@ export default ($root: any) => {
 			? Promise.resolve(file)
 			: $root.$chooseDriveFile({
 				multiple: false,
+				type: 'image/*',
 				title: locale['desktop']['choose-banner']
 			});
 
diff --git a/src/client/app/desktop/script.ts b/src/client/app/desktop/script.ts
index ce0b96e0ac..8065241714 100644
--- a/src/client/app/desktop/script.ts
+++ b/src/client/app/desktop/script.ts
@@ -77,6 +77,7 @@ init(async (launch, os) => {
 					if (document.body.clientWidth > 800) {
 						const w = this.$root.new(MkChooseFileFromDriveWindow, {
 							title: o.title,
+							type: o.type,
 							multiple: o.multiple,
 							initFolder: o.currentFolder
 						});
diff --git a/src/client/app/desktop/views/components/choose-file-from-drive-window.vue b/src/client/app/desktop/views/components/choose-file-from-drive-window.vue
index 8b39e6e00b..71c430edeb 100644
--- a/src/client/app/desktop/views/components/choose-file-from-drive-window.vue
+++ b/src/client/app/desktop/views/components/choose-file-from-drive-window.vue
@@ -11,6 +11,7 @@
 		<x-drive
 			ref="browser"
 			class="browser"
+			:type="type"
 			:multiple="multiple"
 			@selected="onSelected"
 			@change-selection="onChangeSelection"
@@ -33,6 +34,11 @@ export default Vue.extend({
 		XDrive: () => import('./drive.vue').then(m => m.default),
 	},
 	props: {
+		type: {
+			type: String,
+			required: false,
+			default: undefined 
+		},
 		multiple: {
 			default: false
 		}
diff --git a/src/client/app/desktop/views/components/drive.vue b/src/client/app/desktop/views/components/drive.vue
index 4b64d4f22a..2eb9581359 100644
--- a/src/client/app/desktop/views/components/drive.vue
+++ b/src/client/app/desktop/views/components/drive.vue
@@ -80,6 +80,11 @@ export default Vue.extend({
 			type: Object,
 			required: false
 		},
+		type: {
+			type: String,
+			required: false,
+			default: undefined 
+		},
 		multiple: {
 			type: Boolean,
 			default: false
@@ -540,6 +545,7 @@ export default Vue.extend({
 			// ファイル一覧取得
 			this.$root.api('drive/files', {
 				folderId: this.folder ? this.folder.id : null,
+				type: this.type,
 				limit: filesMax + 1
 			}).then(files => {
 				if (files.length == filesMax + 1) {
@@ -570,6 +576,7 @@ export default Vue.extend({
 			// ファイル一覧取得
 			this.$root.api('drive/files', {
 				folderId: this.folder ? this.folder.id : null,
+				type: this.type,
 				untilId: this.files[this.files.length - 1].id,
 				limit: max + 1
 			}).then(files => {
diff --git a/src/client/app/mobile/views/components/drive-file-chooser.vue b/src/client/app/mobile/views/components/drive-file-chooser.vue
index b72c796c1d..8795102f97 100644
--- a/src/client/app/mobile/views/components/drive-file-chooser.vue
+++ b/src/client/app/mobile/views/components/drive-file-chooser.vue
@@ -8,6 +8,7 @@
 		</header>
 		<x-drive class="drive" ref="browser"
 			:select-file="true"
+			:type="type"
 			:multiple="multiple"
 			@change-selection="onChangeSelection"
 			@selected="onSelected"
@@ -25,7 +26,7 @@ export default Vue.extend({
 	components: {
 		XDrive: () => import('./drive.vue').then(m => m.default),
 	},
-	props: ['multiple'],
+	props: ['type', 'multiple'],
 	data() {
 		return {
 			files: []