fix: prevent showing notification errors for dev for known emoji reaction types (#2704)

This commit is contained in:
TAKAHASHI Shuuji 2024-03-20 00:04:16 +09:00 committed by GitHub
parent 9251ec496b
commit e9ab0cd40b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,13 @@ import type { mastodon } from 'masto'
const { notification } = defineProps<{ const { notification } = defineProps<{
notification: mastodon.v1.Notification notification: mastodon.v1.Notification
}>() }>()
const { t } = useI18n()
// well-known emoji reactions types Elk does not support yet
const unsupportedEmojiReactionTypes = ['pleroma:emoji_reaction', 'reaction']
if (unsupportedEmojiReactionTypes.includes(notification.type))
console.warn(`[DEV] ${t('notification.missing_type')} '${notification.type}' (notification.id: ${notification.id})`)
</script> </script>
<template> <template>
@ -88,7 +95,8 @@ const { notification } = defineProps<{
<template v-else-if="notification.type === 'mention' || notification.type === 'poll' || notification.type === 'status'"> <template v-else-if="notification.type === 'mention' || notification.type === 'poll' || notification.type === 'status'">
<StatusCard :status="notification.status!" /> <StatusCard :status="notification.status!" />
</template> </template>
<template v-else> <template v-else-if="!unsupportedEmojiReactionTypes.includes(notification.type)">
<!-- prevent showing errors for dev for known emoji reaction types -->
<!-- type 'favourite' and 'reblog' should always rendered by NotificationGroupedLikes --> <!-- type 'favourite' and 'reblog' should always rendered by NotificationGroupedLikes -->
<div text-red font-bold> <div text-red font-bold>
[DEV] {{ $t('notification.missing_type') }} '{{ notification.type }}' [DEV] {{ $t('notification.missing_type') }} '{{ notification.type }}'