fix(frontend): ピン留め or 履歴に表示されるカスタム絵文字がサーバから削除されるとリアクションが出来なくなる (#13486)
* fix(frontend): ピン留めに登録されているカスタム絵文字がサーバから削除されるとリアクションが出来なくなる * fix CHANGELOG.md * fix Unicode Emojis * fix Unicode Emojis * fix
This commit is contained in:
parent
114d3319e8
commit
32690f576f
8 changed files with 45 additions and 22 deletions
|
@ -77,7 +77,7 @@ const emojiDb = computed(() => {
|
|||
unicodeEmojiDB.push({
|
||||
emoji: emoji,
|
||||
name: k,
|
||||
aliasOf: getEmojiName(emoji)!,
|
||||
aliasOf: getEmojiName(emoji),
|
||||
url: char2path(emoji),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -44,7 +44,7 @@ function getReactionName(reaction: string): string {
|
|||
if (trimLocal.startsWith(':')) {
|
||||
return trimLocal;
|
||||
}
|
||||
return getEmojiName(reaction) ?? reaction;
|
||||
return getEmojiName(reaction);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { computed, inject } from 'vue';
|
||||
import { char2twemojiFilePath, char2fluentEmojiFilePath } from '@/scripts/emoji-base.js';
|
||||
import { char2fluentEmojiFilePath, char2twemojiFilePath } from '@/scripts/emoji-base.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
import { colorizeEmoji, getEmojiName } from '@/scripts/emojilist.js';
|
||||
import * as os from '@/os.js';
|
||||
|
@ -34,8 +34,7 @@ const colorizedNativeEmoji = computed(() => colorizeEmoji(props.emoji));
|
|||
|
||||
// Searching from an array with 2000 items for every emoji felt like too energy-consuming, so I decided to do it lazily on pointerenter
|
||||
function computeTitle(event: PointerEvent): void {
|
||||
const title = getEmojiName(props.emoji as string) ?? props.emoji as string;
|
||||
(event.target as HTMLElement).title = title;
|
||||
(event.target as HTMLElement).title = getEmojiName(props.emoji);
|
||||
}
|
||||
|
||||
function onClick(ev: MouseEvent) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue