[FIX] mail: wrap to new line spaces to avoid bad mention detection

X-original-commit: dc15021752ec83d4f36127b1bf75bece1074757d
This commit is contained in:
Didier (did)
2020-11-09 10:49:33 +00:00
parent 3b48fe700f
commit 4b8ea4d84d
@@ -510,7 +510,7 @@ function factory(dependencies) {
* @returns {mail.partner[]}
*/
_computeMentionedPartners() {
const inputMentions = this.textInputContent.replace(/\n/g, "\n ").match(
const inputMentions = this.textInputContent.replace(/\n/g, " \n ").match(
new RegExp("@[^ ]+(?= | |$)", 'g')
) || [];
const unmentionedPartners = [];
@@ -533,7 +533,7 @@ function factory(dependencies) {
* @returns {mail.partner[]}
*/
_computeMentionedChannels() {
const inputMentions = this.textInputContent.replace('\n', "\n ").match(
const inputMentions = this.textInputContent.replace(/\n/g, " \n ").match(
new RegExp("#[^ ]+(?= | |$)", 'g')
) || [];
const unmentionedChannels = [];
@@ -580,7 +580,7 @@ function factory(dependencies) {
if (this.mentionedPartners.length === 0 && this.mentionedChannels.length === 0) {
return body;
}
const inputMentions = body.replace(new RegExp('<br/>', 'g'), "<br/> ")
const inputMentions = body.replace(new RegExp('<br/>', 'g'), " <br/> ")
.match(new RegExp("(@|#)" + '[^ ]+(?= |&nbsp;|$)', 'g'))
.filter(match => !match.endsWith("<br/>"));
const substrings = [];