[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
This commit is contained in:
len-odoo
2018-11-23 10:32:45 +00:00
parent 06373dde4e
commit 264f89f63f
@@ -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;