diff options
| author | Nasreddin (bon) <bon@odoo.com> | 2020-10-13 08:21:58 +0000 |
|---|---|---|
| committer | Nasreddin (bon) <bon@odoo.com> | 2020-10-15 13:29:16 +0000 |
| commit | 8f12c025e05e5a3a7cf3c5fa8c2696ec99e2fa07 (patch) | |
| tree | efd8d9451595e63551027d8095d7821b17556234 /addons/mail/static/src/models/composer/composer.js | |
| parent | cf8545e10062ba89ac0de5441cfcbdb65d921eaa (diff) | |
[FIX] mail: mail not sent because partner not find in chatter + unit test
Issue
- Install "Project" module
- Go to the chatter of any Task
- Log the following message (by selecting the partner) then send:
"test@test.com
@marc Demo "
Message is not sent.
Cause
When parsing the content, the match result is "@test.com\n@Marc Demo" due
to no space between the two mentions
Solution
Add space after line break (only when parsing selection).
In this case, it will match with 2 mentions instead:
"@test.com\n" and "@marc Demo "
For _generateMentionsLinks step, add a space after '</br>',
it will match 2 mentions but we remove the ones that end
with '</br>'. This last fix is to avoid having a non-mention
string containing '</br>' (for example), and therefore not
having them escaped in final message content.
opw-2322577
closes odoo/odoo#59648
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/composer/composer.js')
| -rw-r--r-- | addons/mail/static/src/models/composer/composer.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js index 3bb12b29433..45e68546813 100644 --- a/addons/mail/static/src/models/composer/composer.js +++ b/addons/mail/static/src/models/composer/composer.js @@ -486,7 +486,7 @@ function factory(dependencies) { * @returns {mail.partner[]} */ _computeMentionedPartners() { - const inputMentions = this.textInputContent.match( + const inputMentions = this.textInputContent.replace('\n', "\n ").match( new RegExp("@[^ ]+(?= | |$)", 'g') ) || []; const unmentionedPartners = []; @@ -556,7 +556,9 @@ function factory(dependencies) { if (this.mentionedPartners.length === 0 && this.mentionedChannels.length === 0) { return body; } - const inputMentions = body.match(new RegExp("(@|#)" + '[^ ]+(?= | |$)', 'g')); + const inputMentions = body.replace("<br/>", "<br/> ") + .match(new RegExp("(@|#)" + '[^ ]+(?= | |$)', 'g')) + .filter(match => !match.endsWith("<br/>")); const substrings = []; let startIndex = 0; for (const match of inputMentions) { |
