1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-05 10:18:09 +09:00

fix(MkEmojiPicker): 削除されたカスタム絵文字が絵文字ピッカーに残ってるとピッカーを使えなくなる問題を修正 (MisskeyIO#480)

+ カスタム絵文字のカテゴリー判定が壊れてる問題を修正
This commit is contained in:
まっちゃとーにゅ 2024-02-27 08:00:55 +09:00 committed by GitHub
parent 4a1000dba3
commit f856abc80e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,7 +49,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@pointerenter="computeButtonTitle" @pointerenter="computeButtonTitle"
@click="chosen(emoji, $event)" @click="chosen(emoji, $event)"
> >
<MkCustomEmoji v-if="!emoji.hasOwnProperty('char')" class="emoji" :name="getKey(emoji)" :normal="true"/> <MkCustomEmoji v-if="!emoji?.hasOwnProperty('char')" class="emoji" :name="getKey(emoji)" :normal="true"/>
<MkEmoji v-else class="emoji" :emoji="getKey(emoji)" :normal="true"/> <MkEmoji v-else class="emoji" :emoji="getKey(emoji)" :normal="true"/>
</button> </button>
</div> </div>
@ -67,7 +67,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@pointerenter="computeButtonTitle" @pointerenter="computeButtonTitle"
@click="chosen(emoji, $event)" @click="chosen(emoji, $event)"
> >
<MkCustomEmoji v-if="!emoji.hasOwnProperty('char')" class="emoji" :name="getKey(emoji)" :normal="true"/> <MkCustomEmoji v-if="!emoji?.hasOwnProperty('char')" class="emoji" :name="getKey(emoji)" :normal="true"/>
<MkEmoji v-else class="emoji" :emoji="getKey(emoji)" :normal="true"/> <MkEmoji v-else class="emoji" :emoji="getKey(emoji)" :normal="true"/>
</button> </button>
</div> </div>
@ -79,8 +79,8 @@ SPDX-License-Identifier: AGPL-3.0-only
v-for="child in customEmojiFolderRoot.children" v-for="child in customEmojiFolderRoot.children"
:key="`custom:${child.category}`" :key="`custom:${child.category}`"
:initialShown="false" :initialShown="false"
:emojis="computed(() => customEmojis.filter(e => filterCategory(e, child.value)).map(e => `:${e.name}:`))" :emojis="computed(() => customEmojis.filter(e => filterCategory(e, child.category)).map(e => `:${e.name}:`))"
:disabledEmojis="computed(() => customEmojis.filter(e => filterCategory(e, child.value)).filter(e => !canReact(e)).map(e => `:${e.name}:`))" :disabledEmojis="computed(() => customEmojis.filter(e => filterCategory(e, child.category)).filter(e => !canReact(e)).map(e => `:${e.name}:`))"
:hasChildSection="child.children.length !== 0" :hasChildSection="child.children.length !== 0"
:customEmojiTree="child.children" :customEmojiTree="child.children"
@chosen="chosen" @chosen="chosen"
@ -152,10 +152,10 @@ const {
} = defaultStore.reactiveState; } = defaultStore.reactiveState;
const recentlyUsedEmojisDef = computed(() => { const recentlyUsedEmojisDef = computed(() => {
return recentlyUsedEmojis.value.map(getDef); return recentlyUsedEmojis.value.map(getDef).filter(x => x !== null);
}); });
const pinnedEmojisDef = computed(() => { const pinnedEmojisDef = computed(() => {
return pinned.value?.map(getDef); return pinned.value?.map(getDef).filter(x => x !== null) ?? [];
}); });
const pinned = computed(() => props.pinnedEmojis); const pinned = computed(() => props.pinnedEmojis);
@ -384,9 +384,9 @@ function getKey(emoji: string | Misskey.entities.EmojiSimple | UnicodeEmojiDef):
function getDef(emoji: string) { function getDef(emoji: string) {
if (emoji.includes(':')) { if (emoji.includes(':')) {
return customEmojisMap.get(emoji.replace(/:/g, ''))!; return customEmojisMap.get(emoji.replace(/:/g, '')) ?? null;
} else { } else {
return unicodeEmojisMap.get(emoji)!; return unicodeEmojisMap.get(emoji) ?? null;
} }
} }