diff options
| author | Didier (did) <did@odoo.com> | 2020-09-25 07:56:23 +0000 |
|---|---|---|
| committer | Didier (did) <did@odoo.com> | 2020-09-29 15:11:20 +0000 |
| commit | 783af6099cc1d97eed226fad001d707aa8cb1957 (patch) | |
| tree | 34630063a74a572d9d892c65ce18d1b7b27cdd98 /addons/mail/static/src/components | |
| parent | bfe3a127f5535e11cc87ebd0fff4a5cfe5039a23 (diff) | |
[FIX] mail: guard the thread name and test the fallback
task-2343800
closes odoo/odoo#58842
X-original-commit: 13d78eda1243a5a625473adbae981b2891221ffc
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/composer/composer.xml | 2 | ||||
| -rw-r--r-- | addons/mail/static/src/components/composer/composer_tests.js | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/addons/mail/static/src/components/composer/composer.xml b/addons/mail/static/src/components/composer/composer.xml index 4aa1d9cfe99..ddd3368c21a 100644 --- a/addons/mail/static/src/components/composer/composer.xml +++ b/addons/mail/static/src/components/composer/composer.xml @@ -38,7 +38,7 @@ <b class="text-muted">To: </b> <em class="text-muted">Followers of </em> <b> - <t t-if="composer.thread"> + <t t-if="composer.thread and composer.thread.name">  "<t t-esc="composer.thread.name"/>" </t> <t t-else=""> diff --git a/addons/mail/static/src/components/composer/composer_tests.js b/addons/mail/static/src/components/composer/composer_tests.js index a3740f91f74..d37162ffa8d 100644 --- a/addons/mail/static/src/components/composer/composer_tests.js +++ b/addons/mail/static/src/components/composer/composer_tests.js @@ -1842,6 +1842,23 @@ QUnit.test('remove an uploading attachment aborts upload', async function (asser }); }); +QUnit.test("basic rendering when sending a message to the followers and thread doesn't have a name", async function (assert) { + assert.expect(1); + + await this.start(); + const thread = this.env.models['mail.thread'].create({ + composer: [['create', { isLog: false }]], + id: 20, + model: 'res.partner', + }); + await this.createComposerComponent(thread.composer, { hasFollowers: true }); + assert.strictEqual( + document.querySelector('.o_Composer_followers').textContent.replace(/\s+/g, ''), + "To:Followersofthisdocument", + "Composer should display \"To: Followers of this document\" if the thread as no name." + ); +}); + }); }); }); |
