From 4b8ea4d84db4d54d3bedca2cabe8425f4d24e55d Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Mon, 2 Nov 2020 09:58:51 +0000 Subject: [PATCH] [FIX] mail: wrap to new line spaces to avoid bad mention detection X-original-commit: dc15021752ec83d4f36127b1bf75bece1074757d --- addons/mail/static/src/models/composer/composer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js index a712f509630..cfec9805308 100644 --- a/addons/mail/static/src/models/composer/composer.js +++ b/addons/mail/static/src/models/composer/composer.js @@ -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('
', 'g'), "
") + const inputMentions = body.replace(new RegExp('
', 'g'), "
") .match(new RegExp("(@|#)" + '[^ ]+(?= | |$)', 'g')) .filter(match => !match.endsWith("
")); const substrings = [];