[FIX] web_editor, website: allow links to unreachable pages
Since commit [1] removed `legacyRejectPromiseHandler()`, trying to edit a link leading to an HTTP error triggers an "Uncaught Promise" error. This commit makes sure such links do not cause a traceback: the link popover is just less detailed (no title, favicon). [1]: https://github.com/odoo/odoo/commit/fcb16a3b1bd373726ffb54f0fbe41fb6d1784769 task-3584686 closes odoo/odoo#141225 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -261,6 +261,13 @@ export class LinkPopoverWidget {
|
||||
this.$urlLink.text(ogTitle ? ogTitle.getAttribute('content') : title.text.trim());
|
||||
}
|
||||
this.$fullUrl.removeClass('d-none').addClass('o_we_webkit_box');
|
||||
}).catch(error => {
|
||||
// HTML error codes should not prevent to edit the links, so we
|
||||
// only check for proper instances of Error.
|
||||
if (error instanceof Error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}).finally(() => {
|
||||
this.$target.popover('update');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -305,9 +305,24 @@ wTourUtils.registerWebsitePreviewTour('link_tools', {
|
||||
trigger: "iframe .s_text_image p a[href='/contactus']:contains('/contactus')",
|
||||
run: () => null,
|
||||
},
|
||||
// 11. Add a link leading to a 404 page
|
||||
{
|
||||
content: "Enter a non-existent URL",
|
||||
trigger: "#o_link_dialog_url_input",
|
||||
run: "text /this-address-does-not-exist",
|
||||
},
|
||||
{
|
||||
content: "Check that the link's href was updated and click on it",
|
||||
trigger: "iframe .s_text_image p a[href='/this-address-does-not-exist']",
|
||||
},
|
||||
{
|
||||
content: "Check popover content is up-to-date",
|
||||
trigger: "iframe .popover div a:contains('/this-address-does-not-exist')",
|
||||
isCheck: true,
|
||||
},
|
||||
...wTourUtils.clickOnSave(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
// 11. Add mega menu with Cards template and edit URL on text-selected card.
|
||||
// 12. Add mega menu with Cards template and edit URL on text-selected card.
|
||||
wTourUtils.clickOnElement("menu link", "iframe header .nav-item a"),
|
||||
wTourUtils.clickOnElement("'Edit menu' icon", "iframe .o_edit_menu_popover .fa-sitemap"),
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user