From 32690f576f75f7bd8fe141c5e3ae524a64e61614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8A=E3=81=95=E3=82=80=E3=81=AE=E3=81=B2=E3=81=A8?= <46447427+samunohito@users.noreply.github.com> Date: Sat, 2 Mar 2024 13:28:10 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E3=83=94=E3=83=B3=E7=95=99?= =?UTF-8?q?=E3=82=81=20or=20=E5=B1=A5=E6=AD=B4=E3=81=AB=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=82=8B=E3=82=AB=E3=82=B9=E3=82=BF=E3=83=A0?= =?UTF-8?q?=E7=B5=B5=E6=96=87=E5=AD=97=E3=81=8C=E3=82=B5=E3=83=BC=E3=83=90?= =?UTF-8?q?=E3=81=8B=E3=82=89=E5=89=8A=E9=99=A4=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=81=A8=E3=83=AA=E3=82=A2=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=81=8C=E5=87=BA=E6=9D=A5=E3=81=AA=E3=81=8F=E3=81=AA=E3=82=8B?= =?UTF-8?q?=20(#13486)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): ピン留めに登録されているカスタム絵文字がサーバから削除されるとリアクションが出来なくなる * fix CHANGELOG.md * fix Unicode Emojis * fix Unicode Emojis * fix --- CHANGELOG.md | 13 ++++++++++++ .../src/components/MkAutocomplete.vue | 2 +- .../src/components/MkEmojiPicker.section.vue | 2 +- .../frontend/src/components/MkEmojiPicker.vue | 13 +++++++----- .../components/MkReactionsViewer.details.vue | 2 +- .../src/components/global/MkEmoji.vue | 5 ++--- .../src/scripts/check-reaction-permissions.ts | 10 +++++----- packages/frontend/src/scripts/emojilist.ts | 20 +++++++++++++------ 8 files changed, 45 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15028e7008..6ce43b12d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,19 @@ --> +## 202x.x.x (unreleased) + +### General +- + +### Client +- Fix: 絵文字関係の不具合を修正 (#13485) + - 履歴に残っている or ピン留めされた絵文字がコントロールパネルより削除されていた際にリアクションデッキが表示できなくなる + - Unicode絵文字が履歴に残っている or ピン留めされているとリアクションデッキが表示できなくなる + +### Server +- + ## 2024.3.0 ### General diff --git a/packages/frontend/src/components/MkAutocomplete.vue b/packages/frontend/src/components/MkAutocomplete.vue index cae6bc7111..2f3855266c 100644 --- a/packages/frontend/src/components/MkAutocomplete.vue +++ b/packages/frontend/src/components/MkAutocomplete.vue @@ -77,7 +77,7 @@ const emojiDb = computed(() => { unicodeEmojiDB.push({ emoji: emoji, name: k, - aliasOf: getEmojiName(emoji)!, + aliasOf: getEmojiName(emoji), url: char2path(emoji), }); } diff --git a/packages/frontend/src/components/MkEmojiPicker.section.vue b/packages/frontend/src/components/MkEmojiPicker.section.vue index c295ab6bb7..012972d8eb 100644 --- a/packages/frontend/src/components/MkEmojiPicker.section.vue +++ b/packages/frontend/src/components/MkEmojiPicker.section.vue @@ -87,7 +87,7 @@ const shown = ref(!!props.initialShown); function computeButtonTitle(ev: MouseEvent): void { const elm = ev.target as HTMLElement; const emoji = elm.dataset.emoji as string; - elm.title = getEmojiName(emoji) ?? emoji; + elm.title = getEmojiName(emoji); } function nestedChosen(emoji: any, ev: MouseEvent) { diff --git a/packages/frontend/src/components/MkEmojiPicker.vue b/packages/frontend/src/components/MkEmojiPicker.vue index 06243e5b04..e30d5969d9 100644 --- a/packages/frontend/src/components/MkEmojiPicker.vue +++ b/packages/frontend/src/components/MkEmojiPicker.vue @@ -353,7 +353,7 @@ watch(q, () => { searchResultUnicode.value = Array.from(searchUnicode()); }); -function canReact(emoji: Misskey.entities.EmojiSimple | UnicodeEmojiDef): boolean { +function canReact(emoji: Misskey.entities.EmojiSimple | UnicodeEmojiDef | string): boolean { return !props.targetNote || checkReactionPermissions($i!, props.targetNote, emoji); } @@ -378,11 +378,14 @@ function getKey(emoji: string | Misskey.entities.EmojiSimple | UnicodeEmojiDef): return typeof emoji === 'string' ? emoji : 'char' in emoji ? emoji.char : `:${emoji.name}:`; } -function getDef(emoji: string) { +function getDef(emoji: string): string | Misskey.entities.EmojiSimple | UnicodeEmojiDef { if (emoji.includes(':')) { - return customEmojisMap.get(emoji.replace(/:/g, ''))!; + // カスタム絵文字が存在する場合はその情報を持つオブジェクトを返し、 + // サーバの管理画面から削除された等で情報が見つからない場合は名前の文字列をそのまま返しておく(undefinedを返すとエラーになるため) + const name = emoji.replaceAll(':', ''); + return customEmojisMap.get(name) ?? emoji; } else { - return getUnicodeEmoji(emoji)!; + return getUnicodeEmoji(emoji); } } @@ -390,7 +393,7 @@ function getDef(emoji: string) { function computeButtonTitle(ev: MouseEvent): void { const elm = ev.target as HTMLElement; const emoji = elm.dataset.emoji as string; - elm.title = getEmojiName(emoji) ?? emoji; + elm.title = getEmojiName(emoji); } function chosen(emoji: any, ev?: MouseEvent) { diff --git a/packages/frontend/src/components/MkReactionsViewer.details.vue b/packages/frontend/src/components/MkReactionsViewer.details.vue index 3158ba436e..8b5e6efdf3 100644 --- a/packages/frontend/src/components/MkReactionsViewer.details.vue +++ b/packages/frontend/src/components/MkReactionsViewer.details.vue @@ -44,7 +44,7 @@ function getReactionName(reaction: string): string { if (trimLocal.startsWith(':')) { return trimLocal; } - return getEmojiName(reaction) ?? reaction; + return getEmojiName(reaction); } diff --git a/packages/frontend/src/components/global/MkEmoji.vue b/packages/frontend/src/components/global/MkEmoji.vue index ba4026f0f6..65f75642b2 100644 --- a/packages/frontend/src/components/global/MkEmoji.vue +++ b/packages/frontend/src/components/global/MkEmoji.vue @@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only