Skip to content

Commit 8e88ae6

Browse files
committed
fix(useGetMessages): process translation on receiving from HPB
Signed-off-by: Maksim Sukharev <[email protected]>
1 parent 27810d6 commit 8e88ae6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/composables/useGetMessages.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { EventBus } from '../services/EventBus.ts'
2727
import { useChatStore } from '../stores/chat.ts'
2828
import { useChatExtrasStore } from '../stores/chatExtras.ts'
2929
import { debugTimer } from '../utils/debugTimer.ts'
30+
import { tryLocalizeSystemMessage } from '../utils/message.ts'
3031
import { useGetThreadId } from './useGetThreadId.ts'
3132
import { useGetToken } from './useGetToken.ts'
3233

@@ -632,6 +633,19 @@ export function useGetMessagesProvider() {
632633
return
633634
}
634635

636+
if (message.systemMessage !== '' && conversation.value) {
637+
// Attempt to localize non-system messages
638+
try {
639+
message.message = tryLocalizeSystemMessage({
640+
message,
641+
conversation: conversation.value,
642+
})
643+
} catch (exception) {
644+
tryPollNewMessages()
645+
return
646+
}
647+
}
648+
635649
// Patch for federated conversations: disable unsupported file shares
636650
if (conversation.value?.remoteServer && Object.keys(message.messageParameters ?? {}).some((key) => key.startsWith('file'))
637651
&& [MESSAGE.TYPE.COMMENT, MESSAGE.TYPE.VOICE_MESSAGE, MESSAGE.TYPE.RECORD_VIDEO, MESSAGE.TYPE.RECORD_AUDIO].includes(message.messageType)) {

0 commit comments

Comments
 (0)