The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/views/room/contextualBar/Discussions/normalizeThreadMessage.js

23 lines
611 B

import { escapeHTML } from '@rocket.chat/string-helpers';
import { renderMessageBody } from '../../../../lib/renderMessageBody';
export const normalizeThreadMessage = ({ ...message }) => {
if (message.msg) {
return renderMessageBody(message).replace(/<br\s?\\?>/g, ' ');
}
if (message.attachments) {
const attachment = message.attachments.find(
(attachment) => attachment.title || attachment.description,
);
if (attachment && attachment.description) {
return escapeHTML(attachment.description);
}
if (attachment && attachment.title) {
return escapeHTML(attachment.title);
}
}
};