summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components
diff options
context:
space:
mode:
authorIvan Yelizariev <iel@odoo.com>2020-12-04 13:41:56 +0000
committerIvan Yelizariev <iel@odoo.com>2020-12-08 16:09:47 +0000
commit5b62b40713d28cc905fd4c54de13cf2de39d988d (patch)
tree52e58136cb5dc9176c6b11561656d996e135d229 /addons/mail/static/src/components
parent46fd7d7979f25c5fe8fe36999186a10ffb6376dc (diff)
[FIX] mail: turn tagged name with special characters into links
STEPS: * Created partner with following name: Putin's spokesman * Tag the partner in a message: @Putin's spokesman BEFORE: tag is not converted into a link AFTER: the link is created WHY: _generateMentionsLinks uses ``owl.utils.escape`` which is different from ``_.escape`` https://github.com/odoo/odoo/blob/880555b38dee0c3e3b364c19bb6b0db983bf8aa0/addons/mail/static/src/models/composer/composer.js#L659 So following replace didn't work: https://github.com/odoo/odoo/blob/880555b38dee0c3e3b364c19bb6b0db983bf8aa0/addons/mail/static/src/models/composer/composer.js#L667 --- opw-2408863 closes odoo/odoo#62893 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components')
-rw-r--r--addons/mail/static/src/components/thread_view/thread_view_tests.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/addons/mail/static/src/components/thread_view/thread_view_tests.js b/addons/mail/static/src/components/thread_view/thread_view_tests.js
index 8e95fd80d4c..f436ddf582d 100644
--- a/addons/mail/static/src/components/thread_view/thread_view_tests.js
+++ b/addons/mail/static/src/components/thread_view/thread_view_tests.js
@@ -1169,6 +1169,48 @@ QUnit.test('Post a message containing an email address followed by a mention on
);
});
+QUnit.test(`Mention a partner with special character (e.g. apostrophe ')`, async function (assert) {
+ assert.expect(1);
+
+ this.data['mail.channel'].records.push({ id: 11 });
+ this.data['res.partner'].records.push({
+ id: 1952,
+ email: "usatyi@example.com",
+ name: "Pynya's spokesman",
+ });
+ await this.start();
+ const thread = this.env.models['mail.thread'].findFromIdentifyingData({
+ id: 11,
+ model: 'mail.channel',
+ });
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ hasThreadView: true,
+ thread: [['link', thread]],
+ });
+ await this.createThreadViewComponent(threadViewer.threadView, { hasComposer: true });
+ document.querySelector('.o_ComposerTextInput_textarea').focus();
+ await afterNextRender(() => {
+ ["@", "P", "y", "n"].forEach((char)=>{
+ document.execCommand('insertText', false, char);
+ document.querySelector(`.o_ComposerTextInput_textarea`)
+ .dispatchEvent(new window.KeyboardEvent('keydown'));
+ document.querySelector(`.o_ComposerTextInput_textarea`)
+ .dispatchEvent(new window.KeyboardEvent('keyup'));
+ });
+ });
+ await afterNextRender(() =>
+ document.querySelector('.o_ComposerSuggestion').click()
+ );
+ await afterNextRender(() => {
+ document.querySelector('.o_Composer_buttonSend').click();
+ });
+ assert.containsOnce(
+ document.querySelector(`.o_Message_content`),
+ `.o_mail_redirect[data-oe-id="1952"][data-oe-model="res.partner"]:contains("@Pynya's spokesman")`,
+ "Conversation should have a message that has been posted, which contains partner mention"
+ );
+});
+
QUnit.test('mention 2 different partners that have the same name', async function (assert) {
assert.expect(3);