summaryrefslogtreecommitdiff
path: root/src/client/app/common/views/components/settings
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-07-19 03:38:05 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-07-19 03:38:05 +0900
commitcd5b24d4eb494a4e9279348639e30b28bcdaa9f9 (patch)
treeabc65a9511b5affbcfd2ff063c8eda2c6251c637 /src/client/app/common/views/components/settings
parentMerge branch 'develop' (diff)
parent11.26.0 (diff)
downloadmisskey-cd5b24d4eb494a4e9279348639e30b28bcdaa9f9.tar.gz
misskey-cd5b24d4eb494a4e9279348639e30b28bcdaa9f9.tar.bz2
misskey-cd5b24d4eb494a4e9279348639e30b28bcdaa9f9.zip
Merge branch 'develop'
Diffstat (limited to 'src/client/app/common/views/components/settings')
-rw-r--r--src/client/app/common/views/components/settings/app-type.vue19
-rw-r--r--src/client/app/common/views/components/settings/profile.vue69
-rw-r--r--src/client/app/common/views/components/settings/settings.vue39
3 files changed, 113 insertions, 14 deletions
diff --git a/src/client/app/common/views/components/settings/app-type.vue b/src/client/app/common/views/components/settings/app-type.vue
index 90ff28803b..d163f1e746 100644
--- a/src/client/app/common/views/components/settings/app-type.vue
+++ b/src/client/app/common/views/components/settings/app-type.vue
@@ -29,8 +29,25 @@ export default Vue.extend({
computed: {
appTypeForce: {
get() { return this.$store.state.device.appTypeForce; },
- set(value) { this.$store.commit('device/set', { key: 'appTypeForce', value }); }
+ set(value) {
+ this.$store.commit('device/set', { key: 'appTypeForce', value });
+ this.reload();
+ }
},
},
+
+ methods: {
+ reload() {
+ this.$root.dialog({
+ type: 'warning',
+ text: this.$t('@.reload-to-apply-the-setting'),
+ showCancelButton: true
+ }).then(({ canceled }) => {
+ if (!canceled) {
+ location.reload();
+ }
+ });
+ },
+ }
});
</script>
diff --git a/src/client/app/common/views/components/settings/profile.vue b/src/client/app/common/views/components/settings/profile.vue
index a22fd6df98..edfc5a9edf 100644
--- a/src/client/app/common/views/components/settings/profile.vue
+++ b/src/client/app/common/views/components/settings/profile.vue
@@ -51,6 +51,26 @@
<template #desc v-if="bannerUploading">{{ $t('uploading') }}<mk-ellipsis/></template>
</ui-input>
+ <div class="fields">
+ <header>{{ $t('profile-metadata') }}</header>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName0">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue0">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName1">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue1">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName2">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue2">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName3">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue3">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ </div>
+
<ui-button @click="save(true)"><fa :icon="faSave"/> {{ $t('save') }}</ui-button>
</ui-form>
</section>
@@ -189,6 +209,17 @@ export default Vue.extend({
this.isLocked = this.$store.state.i.isLocked;
this.carefulBot = this.$store.state.i.carefulBot;
this.autoAcceptFollowed = this.$store.state.i.autoAcceptFollowed;
+
+ if (this.$store.state.i.fields) {
+ this.fieldName0 = this.$store.state.i.fields[0].name;
+ this.fieldValue0 = this.$store.state.i.fields[0].value;
+ this.fieldName1 = this.$store.state.i.fields[1].name;
+ this.fieldValue1 = this.$store.state.i.fields[1].value;
+ this.fieldName2 = this.$store.state.i.fields[2].name;
+ this.fieldValue2 = this.$store.state.i.fields[2].value;
+ this.fieldName3 = this.$store.state.i.fields[3].name;
+ this.fieldValue3 = this.$store.state.i.fields[3].value;
+ }
},
methods: {
@@ -237,6 +268,13 @@ export default Vue.extend({
},
save(notify) {
+ const fields = [
+ { name: this.fieldName0, value: this.fieldValue0 },
+ { name: this.fieldName1, value: this.fieldValue1 },
+ { name: this.fieldName2, value: this.fieldValue2 },
+ { name: this.fieldName3, value: this.fieldValue3 },
+ ];
+
this.saving = true;
this.$root.api('i/update', {
@@ -247,6 +285,7 @@ export default Vue.extend({
birthday: this.birthday || null,
avatarId: this.avatarId || undefined,
bannerId: this.bannerId || undefined,
+ fields,
isCat: !!this.isCat,
isBot: !!this.isBot,
isLocked: !!this.isLocked,
@@ -265,6 +304,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')
+ });
+ }
});
},
@@ -366,4 +428,11 @@ export default Vue.extend({
height 72px
margin auto
+.fields
+ > header
+ padding 8px 0px
+ font-weight bold
+ > div
+ padding-left 16px
+
</style>
diff --git a/src/client/app/common/views/components/settings/settings.vue b/src/client/app/common/views/components/settings/settings.vue
index 281524979e..401d9423ae 100644
--- a/src/client/app/common/views/components/settings/settings.vue
+++ b/src/client/app/common/views/components/settings/settings.vue
@@ -143,13 +143,17 @@
<ui-input v-model="webSearchEngine">{{ $t('@._settings.web-search-engine') }}
<template #desc>{{ $t('@._settings.web-search-engine-desc') }}</template>
</ui-input>
+ <ui-button @click="save('webSearchEngine', webSearchEngine)"><fa :icon="faSave"/> {{ $t('@._settings.save') }}</ui-button>
</section>
<section v-if="!$root.isMobile">
<header>{{ $t('@._settings.paste') }}</header>
<ui-input v-model="pastedFileName">{{ $t('@._settings.pasted-file-name') }}
- <template #desc>{{ $t('@._settings.pasted-file-name-desc') }}</template>
+ <template v-if="pastedFileName === this.$store.state.settings.pastedFileName" #desc>{{ $t('@._settings.pasted-file-name-desc') }}</template>
+ <template v-else #desc>{{ pastedFileNamePreview() }}</template>
</ui-input>
+ <ui-button @click="save('pastedFileName', pastedFileName)"><fa :icon="faSave"/> {{ $t('@._settings.save') }}</ui-button>
+
<ui-switch v-model="pasteDialog">{{ $t('@._settings.paste-dialog') }}
<template #desc>{{ $t('@._settings.paste-dialog-desc') }}</template>
</ui-switch>
@@ -289,6 +293,8 @@ import XNotification from './notification.vue';
import { url, version } from '../../../../config';
import checkForUpdate from '../../../scripts/check-for-update';
+import { formatTimeString } from '../../../../../../misc/format-time-string';
+import { faSave } from '@fortawesome/free-regular-svg-icons';
export default Vue.extend({
i18n: i18n(),
@@ -319,8 +325,11 @@ export default Vue.extend({
return {
meta: null,
version,
+ webSearchEngine: this.$store.state.settings.webSearchEngine,
+ pastedFileName : this.$store.state.settings.pastedFileName,
latestVersion: undefined,
- checkingForUpdate: false
+ checkingForUpdate: false,
+ faSave
};
},
computed: {
@@ -419,16 +428,6 @@ export default Vue.extend({
set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteVisibility', value }); }
},
- webSearchEngine: {
- get() { return this.$store.state.settings.webSearchEngine; },
- set(value) { this.$store.dispatch('settings/set', { key: 'webSearchEngine', value }); }
- },
-
- pastedFileName: {
- get() { return this.$store.state.settings.pastedFileName; },
- set(value) { this.$store.dispatch('settings/set', { key: 'pastedFileName', value }); }
- },
-
pasteDialog: {
get() { return this.$store.state.settings.pasteDialog; },
set(value) { this.$store.dispatch('settings/set', { key: 'pasteDialog', value }); }
@@ -565,6 +564,17 @@ export default Vue.extend({
}
});
},
+ save(key, value) {
+ this.$store.dispatch('settings/set', {
+ key,
+ value
+ }).then(() => {
+ this.$root.dialog({
+ type: 'success',
+ text: this.$t('@._settings.saved')
+ })
+ });
+ },
customizeHome() {
location.href = '/?customize';
},
@@ -600,7 +610,10 @@ export default Vue.extend({
const sound = new Audio(`${url}/assets/message.mp3`);
sound.volume = this.$store.state.device.soundVolume;
sound.play();
- }
+ },
+ pastedFileNamePreview() {
+ return `${formatTimeString(new Date(), this.pastedFileName).replace(/{{number}}/g, `1`)}.png`
+ },
}
});
</script>