From cb645ef0f6619716330e699359378b523b505325 Mon Sep 17 00:00:00 2001 From: Natty Date: Mon, 6 Nov 2023 02:09:06 +0100 Subject: [PATCH] Frontend: Hopefully fixed emoji resolution --- .../src/components/MkReactionsViewer.reaction.vue | 5 ++++- .../client/src/components/global/MkEmoji.vue | 15 ++++++++++++--- .../global/MkMisskeyFlavoredMarkdown.vue | 5 +++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/fe_calckey/frontend/client/src/components/MkReactionsViewer.reaction.vue b/fe_calckey/frontend/client/src/components/MkReactionsViewer.reaction.vue index db0f185..47095da 100644 --- a/fe_calckey/frontend/client/src/components/MkReactionsViewer.reaction.vue +++ b/fe_calckey/frontend/client/src/components/MkReactionsViewer.reaction.vue @@ -17,7 +17,10 @@ :custom-emojis="[ ...note.emojis, typeof url !== 'undefined' - ? { name: reaction, url: url } + ? { + name: reaction.substring(1, reaction.length - 1), + url: url, + } : undefined, ]" /> diff --git a/fe_calckey/frontend/client/src/components/global/MkEmoji.vue b/fe_calckey/frontend/client/src/components/global/MkEmoji.vue index 60b67f2..352e1ac 100644 --- a/fe_calckey/frontend/client/src/components/global/MkEmoji.vue +++ b/fe_calckey/frontend/client/src/components/global/MkEmoji.vue @@ -27,12 +27,17 @@ import { getStaticImageUrl } from "@/scripts/get-static-image-url"; import { char2filePath } from "@/scripts/twemoji-base"; import { defaultStore } from "@/store"; import { instance } from "@/instance"; +import { packed } from "magnetar-common"; +import { magTransProperty } from "@/scripts-mag/mag-util"; const props = defineProps<{ emoji: string; normal?: boolean; noStyle?: boolean; - customEmojis?: Pick[]; + customEmojis?: ( + | packed.PackEmojiBase + | Pick + )[]; isReaction?: boolean; }>(); @@ -45,7 +50,9 @@ const ce = computed(() => props.customEmojis ?? instance.emojis ?? []); const customEmoji = computed(() => isCustom.value ? ce.value.find( - (x) => x.name === props.emoji.substring(1, props.emoji.length - 1) + (x) => + magTransProperty(x, "shortcode", "name") === + props.emoji.substring(1, props.emoji.length - 1) ) : null ); @@ -61,7 +68,9 @@ const url = computed(() => { } }); const alt = computed(() => - customEmoji.value ? `:${customEmoji.value.name}:` : char.value + customEmoji.value + ? `:${magTransProperty(customEmoji.value, "shortcode", "name")}:` + : char.value ); diff --git a/fe_calckey/frontend/client/src/components/global/MkMisskeyFlavoredMarkdown.vue b/fe_calckey/frontend/client/src/components/global/MkMisskeyFlavoredMarkdown.vue index 1b5d9e8..9f34abf 100644 --- a/fe_calckey/frontend/client/src/components/global/MkMisskeyFlavoredMarkdown.vue +++ b/fe_calckey/frontend/client/src/components/global/MkMisskeyFlavoredMarkdown.vue @@ -15,9 +15,10 @@