diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c0ddf27d5dcc61ac2001be6414277180a28df0..c78be1b0906e5af2d9801040f855f096e1613f72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ You should also include the user name that made the change. - ノートã®æœ€å¤§æ–‡å—æ•°ã‚’è¨å®šã§ãる機能ãŒå»ƒæ¢ã•ã‚Œã€ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã§ä¸€å¾‹3000æ–‡å—ã«ãªã‚Šã¾ã—㟠### Improvements -- +- プãƒãƒ•ã‚£ãƒ¼ãƒ«ã®è¿½åŠ æƒ…å ±ã‚’æœ€å¤§16ã¾ã§ä¿å˜ã§ãるよã†ã« ### Bugfixes - Client: リアクションピッカーã®é«˜ã•ãŒä½Žããªã£ãŸã¾ã¾æˆ»ã‚‰ãªã„ã“ã¨ãŒã‚ã‚‹ã®ã‚’ä¿®æ£ @syuilo diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 840e1beeee5eb807dbec668ad4aa23b6a7425a41..df67fb89b33cbe8f5337cc1191078abc623e25a8 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1290,7 +1290,7 @@ _profile: youCanIncludeHashtags: "ãƒãƒƒã‚·ãƒ¥ã‚¿ã‚°ã‚’å«ã‚ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚" metadata: "è¿½åŠ æƒ…å ±" metadataEdit: "è¿½åŠ æƒ…å ±ã‚’ç·¨é›†" - metadataDescription: "プãƒãƒ•ã‚£ãƒ¼ãƒ«ã«è¡¨ã¨ã—ã¦4ã¤ã¾ã§ã®è¿½åŠ æƒ…å ±ã‚’è¡¨ç¤ºã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚" + metadataDescription: "プãƒãƒ•ã‚£ãƒ¼ãƒ«ã«è¡¨ã¨ã—ã¦è¿½åŠ æƒ…å ±ã‚’è¡¨ç¤ºã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚" metadataLabel: "ラベル" metadataContent: "内容" changeAvatar: "ã‚¢ãƒã‚¿ãƒ¼ç”»åƒã‚’変更" diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index d800f23f8eb4ececcd65bc469fac0c9948def452..3488082ab2dca484e267ea40e4b526fb08e663ab 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -79,7 +79,7 @@ export const paramDef = { bannerId: { type: 'string', format: 'misskey:id', nullable: true }, fields: { type: 'array', minItems: 0, - maxItems: 8, + maxItems: 16, items: { type: 'object', properties: { diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index 9b30d1c8e0ae510742585aa6ab54a4218566694d..e463a4271f4c26e8651901d6da2b596d7e20c236 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -32,8 +32,26 @@ <option v-for="x in langs" :key="x[0]" :value="x[0]">{{ x[1] }}</option> </FormSelect> - <FormSlot> - <MkButton @click="editMetadata">{{ i18n.ts._profile.metadataEdit }}</MkButton> + <FormSlot class="_formBlock"> + <FormFolder> + <template #icon><i class="fas fa-table-list"></i></template> + <template #label>{{ i18n.ts._profile.metadataEdit }}</template> + + <div class="_formRoot"> + <div v-for="record in fields" class="_formBlock"> + <FormSplit :min-width="250"> + <FormInput v-model="record.name" class="_formBlock"> + <template #label>{{ i18n.ts._profile.metadataLabel }}</template> + </FormInput> + <FormInput v-model="record.value" class="_formBlock"> + <template #label>{{ i18n.ts._profile.metadataContent }}</template> + </FormInput> + </FormSplit> + </div> + <MkButton :disabled="fields.length >= 16" inline style="margin-right: 8px;" @click="addField">{{ i18n.ts.add }}</MkButton> + <MkButton inline primary @click="saveFields">{{ i18n.ts.save }}</MkButton> + </div> + </FormFolder> <template #caption>{{ i18n.ts._profile.metadataDescription }}</template> </FormSlot> @@ -52,6 +70,8 @@ import FormInput from '@/components/form/input.vue'; import FormTextarea from '@/components/form/textarea.vue'; import FormSwitch from '@/components/form/switch.vue'; import FormSelect from '@/components/form/select.vue'; +import FormSplit from '@/components/form/split.vue'; +import FormFolder from '@/components/form/folder.vue'; import FormSlot from '@/components/form/slot.vue'; import { host, langs } from '@/config'; import { selectFile } from '@/scripts/select-file'; @@ -72,23 +92,31 @@ const profile = reactive({ alwaysMarkNsfw: $i.alwaysMarkNsfw, }); -const additionalFields = reactive({ - fieldName0: $i.fields[0] ? $i.fields[0].name : null, - fieldValue0: $i.fields[0] ? $i.fields[0].value : null, - fieldName1: $i.fields[1] ? $i.fields[1].name : null, - fieldValue1: $i.fields[1] ? $i.fields[1].value : null, - fieldName2: $i.fields[2] ? $i.fields[2].name : null, - fieldValue2: $i.fields[2] ? $i.fields[2].value : null, - fieldName3: $i.fields[3] ? $i.fields[3].name : null, - fieldValue3: $i.fields[3] ? $i.fields[3].value : null, -}); - watch(() => profile, () => { save(); }, { deep: true, }); +const fields = reactive($i.fields.map(field => ({ name: field.name, value: field.value }))); + +function addField() { + fields.push({ + name: '', + value: '', + }); +} + +while (fields.length < 4) { + addField(); +} + +function saveFields() { + os.apiWithDialog('i/update', { + fields: fields.filter(field => field.name !== '' && field.value !== ''), + }); +} + function save() { os.apiWithDialog('i/update', { name: profile.name || null, @@ -123,79 +151,6 @@ function changeBanner(ev) { }); } -async function editMetadata() { - const { canceled, result } = await os.form(i18n.ts._profile.metadata, { - fieldName0: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 1', - default: additionalFields.fieldName0, - }, - fieldValue0: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 1', - default: additionalFields.fieldValue0, - }, - fieldName1: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 2', - default: additionalFields.fieldName1, - }, - fieldValue1: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 2', - default: additionalFields.fieldValue1, - }, - fieldName2: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 3', - default: additionalFields.fieldName2, - }, - fieldValue2: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 3', - default: additionalFields.fieldValue2, - }, - fieldName3: { - type: 'string', - label: i18n.ts._profile.metadataLabel + ' 4', - default: additionalFields.fieldName3, - }, - fieldValue3: { - type: 'string', - label: i18n.ts._profile.metadataContent + ' 4', - default: additionalFields.fieldValue3, - }, - }); - if (canceled) return; - - additionalFields.fieldName0 = result.fieldName0; - additionalFields.fieldValue0 = result.fieldValue0; - additionalFields.fieldName1 = result.fieldName1; - additionalFields.fieldValue1 = result.fieldValue1; - additionalFields.fieldName2 = result.fieldName2; - additionalFields.fieldValue2 = result.fieldValue2; - additionalFields.fieldName3 = result.fieldName3; - additionalFields.fieldValue3 = result.fieldValue3; - - const fields = [ - { name: additionalFields.fieldName0, value: additionalFields.fieldValue0 }, - { name: additionalFields.fieldName1, value: additionalFields.fieldValue1 }, - { name: additionalFields.fieldName2, value: additionalFields.fieldValue2 }, - { name: additionalFields.fieldName3, value: additionalFields.fieldValue3 }, - ]; - - os.api('i/update', { - fields, - }).then(i => { - os.success(); - }).catch(err => { - os.alert({ - type: 'error', - text: err.id - }); - }); -} - defineExpose({ [symbols.PAGE_INFO]: { title: i18n.ts.profile,