summaryrefslogtreecommitdiff
path: root/src/client/app
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-15 09:53:30 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-15 09:53:30 +0900
commitbd827f946a94061f9f720cafe26323ccb605ee92 (patch)
tree1ed4dd13bbb7f1343582de48b97570bd5bfc530d /src/client/app
parentFix (diff)
downloadmisskey-bd827f946a94061f9f720cafe26323ccb605ee92.tar.gz
misskey-bd827f946a94061f9f720cafe26323ccb605ee92.tar.bz2
misskey-bd827f946a94061f9f720cafe26323ccb605ee92.zip
ドライブのファイルの削除を実装
Diffstat (limited to 'src/client/app')
-rw-r--r--src/client/app/desktop/views/components/drive.file.vue6
-rw-r--r--src/client/app/desktop/views/components/drive.vue6
-rw-r--r--src/client/app/mobile/views/components/drive.file-detail.vue20
-rw-r--r--src/client/app/mobile/views/components/drive.vue6
4 files changed, 27 insertions, 11 deletions
diff --git a/src/client/app/desktop/views/components/drive.file.vue b/src/client/app/desktop/views/components/drive.file.vue
index a4531e221f..86addb1318 100644
--- a/src/client/app/desktop/views/components/drive.file.vue
+++ b/src/client/app/desktop/views/components/drive.file.vue
@@ -145,7 +145,7 @@ export default Vue.extend({
(this as any).api('drive/files/update', {
fileId: this.file.id,
name: name
- })
+ });
});
},
@@ -173,7 +173,9 @@ export default Vue.extend({
},
deleteFile() {
- alert('not implemented yet');
+ (this as any).api('drive/files/delete', {
+ fileId: this.file.id
+ });
}
}
});
diff --git a/src/client/app/desktop/views/components/drive.vue b/src/client/app/desktop/views/components/drive.vue
index b69c884089..df141b6d6c 100644
--- a/src/client/app/desktop/views/components/drive.vue
+++ b/src/client/app/desktop/views/components/drive.vue
@@ -118,6 +118,7 @@ export default Vue.extend({
this.connection.on('file_created', this.onStreamDriveFileCreated);
this.connection.on('file_updated', this.onStreamDriveFileUpdated);
+ this.connection.on('file_deleted', this.onStreamDriveFileDeleted);
this.connection.on('folder_created', this.onStreamDriveFolderCreated);
this.connection.on('folder_updated', this.onStreamDriveFolderUpdated);
@@ -130,6 +131,7 @@ export default Vue.extend({
beforeDestroy() {
this.connection.off('file_created', this.onStreamDriveFileCreated);
this.connection.off('file_updated', this.onStreamDriveFileUpdated);
+ this.connection.off('file_deleted', this.onStreamDriveFileDeleted);
this.connection.off('folder_created', this.onStreamDriveFolderCreated);
this.connection.off('folder_updated', this.onStreamDriveFolderUpdated);
(this as any).os.streams.driveStream.dispose(this.connectionId);
@@ -167,6 +169,10 @@ export default Vue.extend({
}
},
+ onStreamDriveFileDeleted(fileId) {
+ this.removeFile(fileId);
+ },
+
onStreamDriveFolderCreated(folder) {
this.addFolder(folder, true);
},
diff --git a/src/client/app/mobile/views/components/drive.file-detail.vue b/src/client/app/mobile/views/components/drive.file-detail.vue
index ad29135268..f6a22f95f0 100644
--- a/src/client/app/mobile/views/components/drive.file-detail.vue
+++ b/src/client/app/mobile/views/components/drive.file-detail.vue
@@ -34,15 +34,10 @@
</div>
<div class="menu">
<div>
- <a :href="`${file.url}?download`" :download="file.name">
- %fa:download%%i18n:@download%
- </a>
- <button @click="rename">
- %fa:pencil-alt%%i18n:@rename%
- </button>
- <button @click="move">
- %fa:R folder-open%%i18n:@move%
- </button>
+ <a :href="`${file.url}?download`" :download="file.name">%fa:download%%i18n:@download%</a>
+ <button @click="rename">%fa:pencil-alt%%i18n:@rename%</button>
+ <button @click="move">%fa:R folder-open%%i18n:@move%</button>
+ <button @click="del">%fa:trash-alt R%%i18n:@delete%</button>
</div>
</div>
<div class="exif" v-show="exif">
@@ -112,6 +107,13 @@ export default Vue.extend({
});
});
},
+ del() {
+ (this as any).api('drive/files/delete', {
+ fileId: this.file.id
+ }).then(() => {
+ this.browser.cd(this.file.folderId, true);
+ });
+ },
showCreatedAt() {
alert(new Date(this.file.createdAt).toLocaleString());
},
diff --git a/src/client/app/mobile/views/components/drive.vue b/src/client/app/mobile/views/components/drive.vue
index 8adf6d8543..c313d225e4 100644
--- a/src/client/app/mobile/views/components/drive.vue
+++ b/src/client/app/mobile/views/components/drive.vue
@@ -100,6 +100,7 @@ export default Vue.extend({
this.connection.on('file_created', this.onStreamDriveFileCreated);
this.connection.on('file_updated', this.onStreamDriveFileUpdated);
+ this.connection.on('file_deleted', this.onStreamDriveFileDeleted);
this.connection.on('folder_created', this.onStreamDriveFolderCreated);
this.connection.on('folder_updated', this.onStreamDriveFolderUpdated);
@@ -118,6 +119,7 @@ export default Vue.extend({
beforeDestroy() {
this.connection.off('file_created', this.onStreamDriveFileCreated);
this.connection.off('file_updated', this.onStreamDriveFileUpdated);
+ this.connection.off('file_deleted', this.onStreamDriveFileDeleted);
this.connection.off('folder_created', this.onStreamDriveFolderCreated);
this.connection.off('folder_updated', this.onStreamDriveFolderUpdated);
(this as any).os.streams.driveStream.dispose(this.connectionId);
@@ -136,6 +138,10 @@ export default Vue.extend({
}
},
+ onStreamDriveFileDeleted(fileId) {
+ this.removeFile(fileId);
+ },
+
onStreamDriveFolderCreated(folder) {
this.addFolder(folder, true);
},