From f0e204f16850d1dcbfa28f02afb7fe1933321fe1 Mon Sep 17 00:00:00 2001 From: pen Date: Sat, 21 Dec 2024 05:01:58 +0000 Subject: [PATCH] fix: if --- packages/frontend/src/components/MkNote.vue | 6 +++--- packages/frontend/src/components/MkNoteDetailed.vue | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index ca5128bf11..1e8cd6d7d4 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -757,14 +757,14 @@ async function clip(): Promise { const isForeignLanguage: boolean = (appearNote.value.text != null || appearNote.value.poll != null) && (() => { const targetLang = (miLocalStorage.getItem('lang') ?? navigator.language).slice(0, 2); if (appearNote.value.text) { - const postLang = detectLanguage(appearNote.value.text); - return postLang !== '' && postLang !== targetLang; + const postLang = detectLanguage(appearNote.value.text); + if (postLang !== '' && postLang !== targetLang) return true; } if (appearNote.value.poll) { const foreignLang = appearNote.value.poll.choices .map((choice) => detectLanguage(choice.text)) .filter((lang) => lang !== targetLang).length; - return 0 < foreignLang; + if (0 < foreignLang) return true; } return false; })(); diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index 958b1ecf91..0ea14ce5cd 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -687,13 +687,13 @@ const isForeignLanguage: boolean = (appearNote.value.text != null || appearNote. const targetLang = (miLocalStorage.getItem('lang') ?? navigator.language).slice(0, 2); if (appearNote.value.text) { const postLang = detectLanguage(appearNote.value.text); - return postLang !== '' && postLang !== targetLang; + if (postLang !== '' && postLang !== targetLang) return true; } if (appearNote.value.poll) { const foreignLang = appearNote.value.poll.choices .map((choice) => detectLanguage(choice.text)) .filter((lang) => lang !== targetLang).length; - return 0 < foreignLang; + if (0 < foreignLang) return true; } return false; })();