diff --git a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/queries.ts b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/queries.ts index bab4cc4a91..f8b43fdb39 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/queries.ts +++ b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/queries.ts @@ -22,6 +22,7 @@ query getChatMessageHistory { message messageId messageType + messageMetadata chatEmphasizedText createdAt user { diff --git a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/services.ts b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/services.ts index 3c9531f48f..ad1df81fae 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/services.ts +++ b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-header/chat-actions/services.ts @@ -2,12 +2,17 @@ import { Message } from '/imports/ui/Types/message'; import { stripTags, unescapeHtml } from '/imports/utils/string-utils'; import { IntlShape, defineMessages } from 'react-intl'; import { ChatMessageType } from '/imports/ui/core/enums/chat'; +import PollService from '/imports/ui/components/poll/service'; const intlMessages = defineMessages({ chatClear: { id: 'app.chat.clearPublicChatMessage', description: 'message of when clear the public chat', }, + pollResult: { + id: 'app.chat.pollResult', + description: 'used in place of user name who published poll to chat', + }, }); export const htmlDecode = (input: string) => { @@ -29,13 +34,22 @@ export const generateExportedMessages = ( const hour = date.getHours().toString().padStart(2, '0'); const min = date.getMinutes().toString().padStart(2, '0'); const hourMin = `[${hour}:${min}]`; - const userName = message.user ? `[${message.user.name} : ${message.user.role}]: ` : ''; + let userName = message.user ? `[${message.user.name} : ${message.user.role}]: ` : ''; let messageText = ''; switch (message.messageType) { case ChatMessageType.CHAT_CLEAR: messageText = intl.formatMessage(intlMessages.chatClear); break; + case ChatMessageType.POLL: { + userName = `${intl.formatMessage(intlMessages.pollResult)}:\n`; + + const metadata = JSON.parse(message.messageMetadata); + const pollText = htmlDecode(PollService.getPollResultString(metadata, intl).split('
').join('\n')); + // remove last \n to avoid empty line + messageText = pollText.slice(0, -1); + break; + } case ChatMessageType.TEXT: default: messageText = htmlDecode(message.message);