From 21d4714654fd59df9f42f3a975369f24ddcf4b7f Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Mon, 16 Oct 2023 13:33:44 +0200 Subject: [PATCH] [IMP] website: not prevent never occurring multiple dialog opening In [1] a mechanism was introduced to prevent the "New page" dialog from being opened several times. That problem occurred at a point during development when the loading of the templates was delaying the display of the dialog, giving time to the used to trigger again the action that opened the dialog. Now that the dialog is actually opening right away to give access to the "Blank Page" pseudo template, the situation cannot occur anymore. To simplify the code, this commit removes that mechanism which is now useless. [1]: https://github.com/odoo/odoo/commit/e0796020ee0c3188e1e9d9fa077de73a2211c6f7 task-3555325 Part-of: odoo/odoo#138748 --- .../static/src/components/dialog/add_page_dialog.js | 7 ------- .../static/src/components/views/page_views_mixin.js | 6 ------ addons/website/static/src/systray_items/new_content.js | 6 ------ 3 files changed, 19 deletions(-) diff --git a/addons/website/static/src/components/dialog/add_page_dialog.js b/addons/website/static/src/components/dialog/add_page_dialog.js index 783344168e1..ec29a2d9a07 100644 --- a/addons/website/static/src/components/dialog/add_page_dialog.js +++ b/addons/website/static/src/components/dialog/add_page_dialog.js @@ -362,9 +362,6 @@ export class AddPageDialog extends Component { this.userService = useService('user'); this.cssLinkEls = undefined; - if (this.props.ready) { - onMounted(() => this.props.ready()); - } this.lastTabName = ""; useSubEnv({ @@ -417,10 +414,6 @@ AddPageDialog.props = { type: Function, optional: true, }, - ready: { - type: Function, - optional: true, - }, websiteId: { type: Number, }, diff --git a/addons/website/static/src/components/views/page_views_mixin.js b/addons/website/static/src/components/views/page_views_mixin.js index a394930981d..efac083c490 100644 --- a/addons/website/static/src/components/views/page_views_mixin.js +++ b/addons/website/static/src/components/views/page_views_mixin.js @@ -41,14 +41,8 @@ export const PageControllerMixin = (component) => class extends component { */ async createWebsiteContent() { if (this.props.resModel === 'website.page') { - if (this.isCreatingNewPage) { - // Prevent opening the "New page" dialog several times. - return; - } - this.isCreatingNewPage = true; return this.dialog.add(AddPageDialog, { websiteId: this.state.activeWebsite.id, - ready: () => this.isCreatingNewPage = false, }); } const action = this.props.context.create_action; diff --git a/addons/website/static/src/systray_items/new_content.js b/addons/website/static/src/systray_items/new_content.js index 607c5e2be68..28c0af923d3 100644 --- a/addons/website/static/src/systray_items/new_content.js +++ b/addons/website/static/src/systray_items/new_content.js @@ -171,15 +171,9 @@ export class NewContentModal extends Component { } createNewPage() { - if (this.isCreatingNewPage) { - // Prevent opening the "New page" dialog several times. - return; - } - this.isCreatingNewPage = true; this.dialogs.add(AddPageDialog, { onAddPage: () => this.websiteContext.showNewContentModal = false, websiteId: this.website.currentWebsite.id, - ready: () => this.isCreatingNewPage = false, }); }