From 140a1dc033354492c665471525b8c56dcbe27db0 Mon Sep 17 00:00:00 2001 From: Artem Savchenko Date: Mon, 27 Oct 2025 11:11:48 +0700 Subject: [PATCH] Fix error for message without translation Signed-off-by: Artem Savchenko --- plugins/communication-resources/src/stores.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/communication-resources/src/stores.ts b/plugins/communication-resources/src/stores.ts index cb1f85c1c44..efad8875851 100644 --- a/plugins/communication-resources/src/stores.ts +++ b/plugins/communication-resources/src/stores.ts @@ -86,7 +86,8 @@ export function hasTranslate ( if (translateTo == null || translateTo === '') return false if (message.language != null && dontTranslate.includes(message.language)) return false - const res = (message.translates?.[translateTo] ?? '').trim() + const translated = message.translates?.[translateTo] + const res = typeof translated === 'string' ? translated.trim() : '' return res !== '' } @@ -138,7 +139,8 @@ export function getMessageTranslation ( if (translateTo == null || translateTo === '') return undefined if (message.language != null && dontTranslate.includes(message.language)) return undefined - const res = (message.translates?.[translateTo] ?? '').trim() + const translated = message.translates?.[translateTo] + const res = typeof translated === 'string' ? translated.trim() : '' return res !== '' ? toMarkup(res) : undefined }