From 264f89f63f89678b01a75a20b508dd10018b00d8 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Wed, 21 Nov 2018 08:03:58 +0000 Subject: [PATCH] [FIX] web_editor: remove video option when composing email Embedding a video can't work because it embeds an iframe, which is not supported by most email clients for security reasons. (What happens when Gmail shows embedded videos in displayed emails, is that you send a link in the email body, and it is at rendering that Gmail adds the iframe into the page.) So the bugfix solution is to hide the button. Since there is an option "res_model" that allows us to know when we are in that case, we remove the video option. opw 1905497 closes odoo/odoo#28911 --- addons/web_editor/static/src/js/widgets/widgets.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index a4c1a29616d..078bfd95bd0 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -986,10 +986,14 @@ var MediaDialog = Dialog.extend({ this.$modal.addClass('note-image-dialog'); this.$modal.find('.modal-dialog').addClass('o_select_media_dialog'); - + // DO NOT FORWARD PORT + this.mailCompose = this.options.res_model === "mail.compose.message"; this.only_images = this.options.only_images || this.options.select_images || (this.media && ($(this.media).parent().data("oe-field") === "image" || $(this.media).parent().data("oe-type") === "image")); + if (this.only_images || this.mailCompose) { + this.$('[href="#editor-media-video"]').addClass('hidden'); + } if (this.only_images) { - this.$('[href="#editor-media-document"], [href="#editor-media-video"], [href="#editor-media-icon"]').addClass('hidden'); + this.$('[href="#editor-media-document"], [href="#editor-media-icon"]').addClass('hidden'); } this.opened((function () { @@ -1016,8 +1020,10 @@ var MediaDialog = Dialog.extend({ if (!this.only_images) { this.iconDialog = new fontIconsDialog(this, this.media, this.options); this.iconDialog.appendTo(this.$("#editor-media-icon")); - this.videoDialog = new VideoDialog(this, this.media, this.options); - this.videoDialog.appendTo(this.$("#editor-media-video")); + if (!this.mailCompose) { + this.videoDialog = new VideoDialog(this, this.media, this.options); + this.videoDialog.appendTo(this.$("#editor-media-video")); + } } this.active = this.imageDialog;