summaryrefslogtreecommitdiff
path: root/src/client/app/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/common')
-rw-r--r--src/client/app/common/scripts/post-form.ts2
-rw-r--r--src/client/app/common/views/components/messaging-room.form.vue2
-rw-r--r--src/client/app/common/views/components/settings/drive.vue33
-rw-r--r--src/client/app/common/views/widgets/post-form.vue2
4 files changed, 34 insertions, 5 deletions
diff --git a/src/client/app/common/scripts/post-form.ts b/src/client/app/common/scripts/post-form.ts
index 7cd2e7c310..1d93b4c268 100644
--- a/src/client/app/common/scripts/post-form.ts
+++ b/src/client/app/common/scripts/post-form.ts
@@ -245,7 +245,7 @@ export default (opts) => ({
},
upload(file) {
- (this.$refs.uploader as any).upload(file);
+ (this.$refs.uploader as any).upload(file, this.$store.state.settings.uploadFolder);
},
onChangeUploadings(uploads) {
diff --git a/src/client/app/common/views/components/messaging-room.form.vue b/src/client/app/common/views/components/messaging-room.form.vue
index 1dfb0589e4..74e30d29e8 100644
--- a/src/client/app/common/views/components/messaging-room.form.vue
+++ b/src/client/app/common/views/components/messaging-room.form.vue
@@ -158,7 +158,7 @@ export default Vue.extend({
},
upload(file) {
- (this.$refs.uploader as any).upload(file);
+ (this.$refs.uploader as any).upload(file, this.$store.state.settings.uploadFolder);
},
onUploaded(file) {
diff --git a/src/client/app/common/views/components/settings/drive.vue b/src/client/app/common/views/components/settings/drive.vue
index 7bdc806ae7..9b049c98e3 100644
--- a/src/client/app/common/views/components/settings/drive.vue
+++ b/src/client/app/common/views/components/settings/drive.vue
@@ -11,6 +11,12 @@
<header>{{ $t('stats') }}</header>
<div ref="chart" style="margin-bottom: -16px; margin-left: -8px; color: #000;"></div>
</section>
+
+ <section>
+ <header>{{ $t('default-upload-folder') }}</header>
+ <ui-input v-model="uploadFolderName" readonly>{{ $t('default-upload-folder-name') }}</ui-input>
+ <ui-button @click="chooseUploadFolder()">{{ $t('change-default-upload-folder') }}</ui-button>
+ </section>
</ui-card>
</template>
@@ -26,7 +32,8 @@ export default Vue.extend({
return {
fetching: true,
usage: null,
- capacity: null
+ capacity: null,
+ uploadFolderName: null
};
},
@@ -40,10 +47,25 @@ export default Vue.extend({
l: 0.5
})
};
- }
+ },
+
+ uploadFolder: {
+ get() { return this.$store.state.settings.uploadFolder; },
+ set(value) { this.$store.dispatch('settings/set', { key: 'uploadFolder', value }); }
+ },
},
mounted() {
+ if (this.uploadFolder == null) {
+ this.uploadFolderName = this.$t('@._settings.root');
+ } else {
+ this.$root.api('drive/folders/show', {
+ folderId: this.uploadFolder
+ }).then(folder => {
+ this.uploadFolderName = folder.name;
+ });
+ }
+
this.$root.api('drive').then(info => {
this.capacity = info.capacity;
this.usage = info.usage;
@@ -152,6 +174,13 @@ export default Vue.extend({
chart.render();
});
+ },
+
+ chooseUploadFolder() {
+ this.$chooseDriveFolder().then(folder => {
+ this.uploadFolder = folder ? folder.id : null;
+ this.uploadFolderName = folder ? folder.name : this.$t('@._settings.root');
+ })
}
}
});
diff --git a/src/client/app/common/views/widgets/post-form.vue b/src/client/app/common/views/widgets/post-form.vue
index e180290f95..5e577c9a43 100644
--- a/src/client/app/common/views/widgets/post-form.vue
+++ b/src/client/app/common/views/widgets/post-form.vue
@@ -122,7 +122,7 @@ export default define({
},
upload(file) {
- (this.$refs.uploader as any).upload(file);
+ (this.$refs.uploader as any).upload(file, this.$store.state.settings.uploadFolder);
},
onDragover(e) {