fix (client): noteTranslation is nullable

!10899
This commit is contained in:
naskya 2024-05-23 22:49:25 +09:00
parent c04c071aec
commit 747f1d6e04
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
4 changed files with 7 additions and 7 deletions

View file

@ -82,7 +82,7 @@
:enableEmojiReactions
:hideEmojiViewer
:detailedView
:note-translation="noteTranslation!"
:note-translation="noteTranslation"
@deleted="isDeleted = true"
@event:focus="focus"
@event:blur="blur"

View file

@ -47,7 +47,7 @@
:enableEmojiReactions
:hideEmojiViewer
:detailedView
:note-translation="noteTranslation!"
:note-translation="noteTranslation"
@deleted="isDeleted = true"
@event:focus="focus"
@event:blur="blur"

View file

@ -74,11 +74,11 @@
v-if="
isSignedIn(me) &&
isForeignLanguage &&
noteTranslation.canTranslate
noteTranslation?.canTranslate
"
v-tooltip.noDelay.bottom="i18n.ts.translate"
class="button _button"
@click.stop="noteTranslation.translate"
@click.stop="noteTranslation?.translate"
>
<i :class="icon('ph-translate')"></i>
</button>
@ -118,7 +118,7 @@ const props = defineProps<{
enableEmojiReactions?: boolean;
hideEmojiViewer?: boolean;
detailedView?: boolean;
noteTranslation: InstanceType<typeof MkNoteTranslation>;
noteTranslation: InstanceType<typeof MkNoteTranslation> | null;
}>();
const emit = defineEmits<{
@ -151,7 +151,7 @@ const isForeignLanguage = computed(
props.note.text != null &&
(() => {
const postLang = detectLanguage(props.note.text);
return postLang !== "" && postLang !== props.noteTranslation.targetLang;
return postLang !== "" && postLang !== props.noteTranslation?.targetLang;
})(),
);

View file

@ -22,7 +22,7 @@ export function getNoteMenu(props: {
note: entities.Note;
menuButton: Ref<HTMLElement | undefined>;
isDeleted: Ref<boolean>;
translationEl: InstanceType<typeof MkNoteTranslation>;
translationEl: InstanceType<typeof MkNoteTranslation> | null;
currentClipPage?: Ref<entities.Clip> | null;
}) {
const isRenote =