From f414c9f3f89d39e761add2f07c1f6f903bf805ac Mon Sep 17 00:00:00 2001 From: Vincent Schippefilt Date: Wed, 6 Mar 2019 14:02:24 +0100 Subject: [PATCH] [REF] portal: adapt code after jQuery update Part of task 1896658 Co-authored-by: Aaron Bohy Co-authored-by: Christophe Matthieu Co-authored-by: Mathieu Duckerts-Antoine Co-authored-by: David Monjoie Co-authored-by: Martin Geubelle Co-authored-by: svs-odoo Co-authored-by: Vincent Schippefilt --- addons/portal/static/src/js/portal.js | 2 +- addons/portal/static/src/js/portal_chatter.js | 12 ++++++------ addons/portal/static/src/js/portal_signature.js | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/portal/static/src/js/portal.js b/addons/portal/static/src/js/portal.js index 08e37bb2681..8c117167699 100644 --- a/addons/portal/static/src/js/portal.js +++ b/addons/portal/static/src/js/portal.js @@ -34,7 +34,7 @@ publicWidget.registry.portalDetails = publicWidget.Widget.extend({ var countryID = ($country.val() || 0); this.$stateOptions.detach(); var $displayedState = this.$stateOptions.filter('[data-country_id=' + countryID + ']'); - var nb = $displayedState.appendTo(this.$state).show().size(); + var nb = $displayedState.appendTo(this.$state).show().length; this.$state.parent().toggle(nb >= 1); }, diff --git a/addons/portal/static/src/js/portal_chatter.js b/addons/portal/static/src/js/portal_chatter.js index 081a8f02ad3..56a833a03a7 100644 --- a/addons/portal/static/src/js/portal_chatter.js +++ b/addons/portal/static/src/js/portal_chatter.js @@ -44,7 +44,7 @@ var PortalComposer = publicWidget.Widget.extend({ * @private */ _onSubmitButtonClick: function () { - return $.Deferred(); + return new Promise(function() {}); }, }); @@ -102,10 +102,10 @@ var PortalChatter = publicWidget.Widget.extend({ * @override */ willStart: function () { - return $.when( + return Promise.all([ this._super.apply(this, arguments), this._chatterInit() - ); + ]); }, /** * @override @@ -133,7 +133,7 @@ var PortalChatter = publicWidget.Widget.extend({ defs.push(this._composer.replace(this.$('.o_portal_chatter_composer'))); } - return $.when.apply($, defs); + return Promise.all(defs); }, //-------------------------------------------------------------------------- @@ -145,7 +145,7 @@ var PortalChatter = publicWidget.Widget.extend({ * current page and current domain. * * @param {Array} domain - * @returns {Deferred} + * @returns {Promise} */ messageFetch: function (domain) { var self = this; @@ -307,7 +307,7 @@ publicWidget.registry.portalChatter = publicWidget.Widget.extend({ var defs = [this._super.apply(this, arguments)]; var chatter = new PortalChatter(this, this.$el.data()); defs.push(chatter.appendTo(this.$el)); - return $.when.apply($, defs); + return Promise.all(defs); }, }); diff --git a/addons/portal/static/src/js/portal_signature.js b/addons/portal/static/src/js/portal_signature.js index 0174eeacdfe..471ea3b1e4a 100644 --- a/addons/portal/static/src/js/portal_signature.js +++ b/addons/portal/static/src/js/portal_signature.js @@ -129,7 +129,7 @@ var SignatureForm = publicWidget.Widget.extend({ window.location.reload(); } // no resolve if we reload the page - return $.Deferred(); + return new Promise(function () { }); } }); }, @@ -180,10 +180,10 @@ publicWidget.registry.SignatureForm = publicWidget.Widget.extend({ } }); - return $.when( + return Promise.all([ this._super.apply(this, arguments), form.appendTo(this.$el) - ); + ]); }, });