Frontend: Hopefully fixed emoji resolution
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2023-11-06 02:09:06 +01:00
parent b4611bda78
commit cb645ef0f6
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
3 changed files with 19 additions and 6 deletions

View File

@ -17,7 +17,10 @@
:custom-emojis="[ :custom-emojis="[
...note.emojis, ...note.emojis,
typeof url !== 'undefined' typeof url !== 'undefined'
? { name: reaction, url: url } ? {
name: reaction.substring(1, reaction.length - 1),
url: url,
}
: undefined, : undefined,
]" ]"
/> />

View File

@ -27,12 +27,17 @@ import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import { char2filePath } from "@/scripts/twemoji-base"; import { char2filePath } from "@/scripts/twemoji-base";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
import { instance } from "@/instance"; import { instance } from "@/instance";
import { packed } from "magnetar-common";
import { magTransProperty } from "@/scripts-mag/mag-util";
const props = defineProps<{ const props = defineProps<{
emoji: string; emoji: string;
normal?: boolean; normal?: boolean;
noStyle?: boolean; noStyle?: boolean;
customEmojis?: Pick<Misskey.entities.CustomEmoji, "name" | "url">[]; customEmojis?: (
| packed.PackEmojiBase
| Pick<Misskey.entities.CustomEmoji, "name" | "url">
)[];
isReaction?: boolean; isReaction?: boolean;
}>(); }>();
@ -45,7 +50,9 @@ const ce = computed(() => props.customEmojis ?? instance.emojis ?? []);
const customEmoji = computed(() => const customEmoji = computed(() =>
isCustom.value isCustom.value
? ce.value.find( ? 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 : null
); );
@ -61,7 +68,9 @@ const url = computed(() => {
} }
}); });
const alt = computed(() => const alt = computed(() =>
customEmoji.value ? `:${customEmoji.value.name}:` : char.value customEmoji.value
? `:${magTransProperty(customEmoji.value, "shortcode", "name")}:`
: char.value
); );
</script> </script>

View File

@ -15,9 +15,10 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {} from "vue";
import MfmCore from "@/components/mfm"; import MfmCore from "@/components/mfm";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
import * as Misskey from "calckey-js";
import { packed } from "magnetar-common";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@ -25,7 +26,7 @@ const props = withDefaults(
plain?: boolean; plain?: boolean;
nowrap?: boolean; nowrap?: boolean;
author?: any; author?: any;
customEmojis?: any; customEmojis?: (packed.PackEmojiBase | Misskey.entities.CustomEmoji)[];
isNote?: boolean; isNote?: boolean;
advancedMfm: boolean; advancedMfm: boolean;
}>(), }>(),