[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
This commit is contained in:
Benoit Socias
2023-10-25 09:56:40 +00:00
committed by Romain Derie
parent 8642b0c409
commit 21d4714654
3 changed files with 0 additions and 19 deletions
@@ -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,
},
@@ -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;
@@ -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,
});
}