From bfdfc2c778fb627e9acce32e9c34e293a878e1d1 Mon Sep 17 00:00:00 2001 From: samunohito <46447427+samunohito@users.noreply.github.com> Date: Sun, 18 Feb 2024 15:14:52 +0900 Subject: [PATCH] fix paste bugs --- .../admin/custom-emojis-manager.local.list.vue | 15 +++++---------- .../custom-emojis-manager.local.register.vue | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/pages/admin/custom-emojis-manager.local.list.vue b/packages/frontend/src/pages/admin/custom-emojis-manager.local.list.vue index 48c6f80a69..189c1df4dd 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-manager.local.list.vue +++ b/packages/frontend/src/pages/admin/custom-emojis-manager.local.list.vue @@ -296,15 +296,10 @@ function setupGrid(): GridSetting { bindTo: 'url', icon: 'ti-icons', type: 'image', editable: true, width: 'auto', validators: [required], customValueEditor: async (row, col, value, cellElement) => { const file = await selectFile(cellElement); - if (file) { - gridItems.value[row.index].url = file.url; - gridItems.value[row.index].fileId = file.id; - } else { - gridItems.value[row.index].url = ''; - gridItems.value[row.index].fileId = undefined; - } + gridItems.value[row.index].url = file.url; + gridItems.value[row.index].fileId = file.id; - return file ? file.url : ''; + return file.url; }, }, { bindTo: 'name', title: 'name', type: 'text', editable: true, width: 140, validators: [required, regex] }, @@ -317,8 +312,8 @@ function setupGrid(): GridSetting { bindTo: 'roleIdsThatCanBeUsedThisEmojiAsReaction', title: 'role', type: 'text', editable: true, width: 140, valueTransformer: (row) => { // バックエンドからからはIDと名前のペア配列で受け取るが、表示にIDがあると煩雑なので名前だけにする - return gridItems.value[row.index].roleIdsThatCanBeUsedThisEmojiAsReaction - .map(({ name }) => name) + return (gridItems.value[row.index].roleIdsThatCanBeUsedThisEmojiAsReaction ?? []) + .map((it) => it.name) .join(','); }, customValueEditor: async (row) => { diff --git a/packages/frontend/src/pages/admin/custom-emojis-manager.local.register.vue b/packages/frontend/src/pages/admin/custom-emojis-manager.local.register.vue index a1690645ab..9ccb6a4052 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-manager.local.register.vue +++ b/packages/frontend/src/pages/admin/custom-emojis-manager.local.register.vue @@ -163,8 +163,8 @@ function setupGrid(): GridSetting { bindTo: 'roleIdsThatCanBeUsedThisEmojiAsReaction', title: 'role', type: 'text', editable: true, width: 140, valueTransformer: (row) => { // バックエンドからからはIDと名前のペア配列で受け取るが、表示にIDがあると煩雑なので名前だけにする - return gridItems.value[row.index].roleIdsThatCanBeUsedThisEmojiAsReaction - .map(({ name }) => name) + return (gridItems.value[row.index].roleIdsThatCanBeUsedThisEmojiAsReaction ?? []) + .map((it) => it.name) .join(','); }, customValueEditor: async (row) => {