Merge pull request #19724 from ramonlsouza/issue-19168

fix: user away message on chat export
This commit is contained in:
Ramón Souza 2024-03-04 11:28:21 -03:00 committed by GitHub
commit cedddf8e2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,7 @@ query getChatMessageHistory {
messageId
messageType
messageMetadata
senderName
chatEmphasizedText
createdAt
user {

View File

@ -13,6 +13,14 @@ const intlMessages = defineMessages({
id: 'app.chat.pollResult',
description: 'used in place of user name who published poll to chat',
},
userAway: {
id: 'app.chat.away',
description: 'message when user is away',
},
userNotAway: {
id: 'app.chat.notAway',
description: 'message when user is no longer away',
},
});
export const htmlDecode = (input: string) => {
@ -50,6 +58,14 @@ export const generateExportedMessages = (
messageText = pollText.slice(0, -1);
break;
}
case ChatMessageType.USER_AWAY_STATUS_MSG: {
const { away } = JSON.parse(message.messageMetadata);
messageText = (away)
? `${message.senderName} ${intl.formatMessage(intlMessages.userAway)}`
: `${message.senderName} ${intl.formatMessage(intlMessages.userNotAway)}`;
break;
}
case ChatMessageType.TEXT:
default:
messageText = htmlDecode(message.message);