Skip to content

Commit

Permalink
fix: @ in message resets the format - EXO-69693.
Browse files Browse the repository at this point in the history
Before this change, when type a message having multiple line and add @ anywhere in message and send message. After this change, this message is sent and displayed correctly.
  • Loading branch information
akhanfir committed Feb 15, 2024
1 parent 00c3961 commit f718a91
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,21 +383,21 @@ export default {
elem.style.height = `${elem.scrollHeight + BORDER_SIZE}px`;
elem.scrollTop = elem.scrollHeight;
},
checkMention(message) {
message = $('<div />').html(message).text();
checkMention(msg) {
let message = $('<div />').html(msg).text();
message = message.replace(/\s\s+/g, ' ');
message = this.encodeHTMLEntities(message);
for (const element of this.participants) {
if (message.includes(`@${element.fullname}`) ){
this.mentionedUsers.push(element.name);
const profil = chatServices.getUserProfileLink(element.name);
const html = `<a href='${profil}' target='_blank'>@${element.fullname}</a>`;
message = message.replaceAll(`@${element.fullname}`, html);
msg = message.replaceAll(`@${element.fullname}`, html);
}
}
chatServices.sendMentionNotification(this.contact.room, this.contact.fullName, this.mentionedUsers);
this.mentionedUsers = [];
return message;
return msg;
},
encodeHTMLEntities(text) {
const textArea = document.createElement('p');
Expand Down

0 comments on commit f718a91

Please sign in to comment.