Feature: Support file type messages on widget and dashboard (#659)

- Adds support for file upload

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Nithin David Thomas
2020-04-02 12:28:38 +05:30
committed by GitHub
parent 0afa5c297f
commit 7fcd2d0e85
28 changed files with 338 additions and 69 deletions

View File

@@ -15,7 +15,8 @@ class MessageFormatter {
const urlRegex = /(https?:\/\/[^\s]+)/g;
return this.message.replace(
urlRegex,
url => `<a href="${url}" target="_blank">${url}</a>`
url =>
`<a rel="noreferrer noopener nofollow" href="${url}" target="_blank">${url}</a>`
);
}

View File

@@ -6,7 +6,7 @@ describe('#MessageFormatter', () => {
const message =
'Chatwoot is an opensource tool\nSee more at https://www.chatwoot.com';
expect(new MessageFormatter(message).formattedMessage).toEqual(
'Chatwoot is an opensource tool<br>See more at <a href="https://www.chatwoot.com" target="_blank">https://www.chatwoot.com</a>'
'Chatwoot is an opensource tool<br>See more at <a rel="noreferrer noopener nofollow" href="https://www.chatwoot.com" target="_blank">https://www.chatwoot.com</a>'
);
});
});