From 747f1d6e0484957bd32550776f558fabe5351882 Mon Sep 17 00:00:00 2001 From: naskya Date: Thu, 23 May 2024 22:49:25 +0900 Subject: [PATCH] fix (client): noteTranslation is nullable !10899 --- packages/client/src/components/MkNote.vue | 2 +- packages/client/src/components/MkNoteSub.vue | 2 +- packages/client/src/components/note/MkNoteFooter.vue | 8 ++++---- packages/client/src/scripts/get-note-menu.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index 0b3012da24..5d6fe6bdce 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -82,7 +82,7 @@ :enableEmojiReactions :hideEmojiViewer :detailedView - :note-translation="noteTranslation!" + :note-translation="noteTranslation" @deleted="isDeleted = true" @event:focus="focus" @event:blur="blur" diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index b2886fbb6c..979168e22f 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -47,7 +47,7 @@ :enableEmojiReactions :hideEmojiViewer :detailedView - :note-translation="noteTranslation!" + :note-translation="noteTranslation" @deleted="isDeleted = true" @event:focus="focus" @event:blur="blur" diff --git a/packages/client/src/components/note/MkNoteFooter.vue b/packages/client/src/components/note/MkNoteFooter.vue index aff161ff47..10f5caaec9 100644 --- a/packages/client/src/components/note/MkNoteFooter.vue +++ b/packages/client/src/components/note/MkNoteFooter.vue @@ -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" > @@ -118,7 +118,7 @@ const props = defineProps<{ enableEmojiReactions?: boolean; hideEmojiViewer?: boolean; detailedView?: boolean; - noteTranslation: InstanceType; + noteTranslation: InstanceType | 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; })(), ); diff --git a/packages/client/src/scripts/get-note-menu.ts b/packages/client/src/scripts/get-note-menu.ts index e323a992f6..17939122ed 100644 --- a/packages/client/src/scripts/get-note-menu.ts +++ b/packages/client/src/scripts/get-note-menu.ts @@ -22,7 +22,7 @@ export function getNoteMenu(props: { note: entities.Note; menuButton: Ref; isDeleted: Ref; - translationEl: InstanceType; + translationEl: InstanceType | null; currentClipPage?: Ref | null; }) { const isRenote =