diff options
| author | Xavier Dubuc <xdu@odoo.com> | 2020-08-04 14:38:02 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-13 10:23:25 +0000 |
| commit | a17725e99899ff1e06996f7c9ab93704c840131e (patch) | |
| tree | b82159288fd50294aeb28f17ac260a59c48cc736 /addons/mail/static/src | |
| parent | b0107e9230da5cb5c90819e5bee3e9cd323816ee (diff) | |
[FIX] mail: fix full composer opening with attachments
task-2307201
closes odoo/odoo#55678
X-original-commit: 9c47bb0b0034a3419a0c6e3267d90cb520a59535
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src')
6 files changed, 24 insertions, 36 deletions
diff --git a/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js b/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js index 23a8c42dea1..e757fcc9016 100644 --- a/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js +++ b/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js @@ -5,12 +5,14 @@ const { afterEach: utilsAfterEach, afterNextRender, beforeEach: utilsBeforeEach, - inputFiles, start: utilsStart, } = require('mail/static/src/utils/test_utils.js'); const { - file: { createFile }, + file: { + createFile, + inputFiles, + }, dom: { triggerEvent }, } = require('web.test_utils'); diff --git a/addons/mail/static/src/components/composer/composer_tests.js b/addons/mail/static/src/components/composer/composer_tests.js index a22f4ec1ac3..a961f77e62f 100644 --- a/addons/mail/static/src/components/composer/composer_tests.js +++ b/addons/mail/static/src/components/composer/composer_tests.js @@ -10,13 +10,17 @@ const { beforeEach: utilsBeforeEach, dragenterFiles, dropFiles, - inputFiles, nextAnimationFrame, pasteFiles, start: utilsStart, } = require('mail/static/src/utils/test_utils.js'); -const { file: { createFile } } = require('web.test_utils'); +const { + file: { + createFile, + inputFiles, + }, +} = require('web.test_utils'); QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { diff --git a/addons/mail/static/src/components/discuss/tests/discuss_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_tests.js index 9f93b935adf..e7ae5b33bc3 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js @@ -7,12 +7,17 @@ const { afterEach: utilsAfterEach, afterNextRender, beforeEach: utilsBeforeEach, - inputFiles, start: utilsStart, } = require('mail/static/src/utils/test_utils.js'); const Bus = require('web.Bus'); -const { makeTestPromise, file: { createFile } } = require('web.test_utils'); +const { + makeTestPromise, + file: { + createFile, + inputFiles, + }, +} = require('web.test_utils'); QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { diff --git a/addons/mail/static/src/components/file_uploader/file_uploader_tests.js b/addons/mail/static/src/components/file_uploader/file_uploader_tests.js index a5831a89efb..6b982c62898 100644 --- a/addons/mail/static/src/components/file_uploader/file_uploader_tests.js +++ b/addons/mail/static/src/components/file_uploader/file_uploader_tests.js @@ -7,12 +7,16 @@ const components = { const { afterEach: utilsAfterEach, beforeEach: utilsBeforeEach, - inputFiles, nextAnimationFrame, start: utilsStart, } = require('mail/static/src/utils/test_utils.js'); -const { file: { createFile } } = require('web.test_utils'); +const { + file: { + createFile, + inputFiles, + }, +} = require('web.test_utils'); QUnit.module('mail', {}, function () { QUnit.module('components', {}, function () { diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js index 91d53a6e6b0..f2d376fd14b 100644 --- a/addons/mail/static/src/models/composer/composer.js +++ b/addons/mail/static/src/models/composer/composer.js @@ -86,7 +86,7 @@ function factory(dependencies) { * Open the full composer modal. */ async openFullComposer() { - const attachmentIds = this.attachments.map(attachment => attachment.res_id); + const attachmentIds = this.attachments.map(attachment => attachment.id); const context = { default_attachment_ids: attachmentIds, diff --git a/addons/mail/static/src/utils/test_utils.js b/addons/mail/static/src/utils/test_utils.js index 801daddba20..3a3186fad18 100644 --- a/addons/mail/static/src/utils/test_utils.js +++ b/addons/mail/static/src/utils/test_utils.js @@ -847,32 +847,6 @@ function dropFiles(el, files) { } /** - * Set files in a file input - * - * @param {DOM.Element} el - * @param {Object[]} files must have been created beforehand - * @see testUtils.file.createFile - */ -function inputFiles(el, files) { - const dataTransfer = new window.DataTransfer(); - for (const file of files) { - dataTransfer.items.add(file); - } - el.files = dataTransfer.files; - /** - * Changing files programatically is not supposed to trigger the event but - * it does in Chrome versions before 73 (which is on runbot), so in that - * case there is no need to make a manual dispatch, because it would lead to - * the files being added twice. - */ - const versionRaw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); - const chromeVersion = versionRaw ? parseInt(versionRaw[2], 10) : false; - if (!chromeVersion || chromeVersion >= 73) { - el.dispatchEvent(new Event('change')); - } -} - -/** * Paste some files on a DOM element * * @param {DOM.Element} el @@ -897,7 +871,6 @@ return { beforeEach, dragenterFiles, dropFiles, - inputFiles, nextAnimationFrame, nextTick, pasteFiles, |
