From b6672a4f9fc3e746a52bf300c3201590acad0131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 21 Sep 2018 00:40:51 +0200 Subject: [PATCH] Less harsh failure mode when attempting to undo in mobile editor The fancy mobile editor doesn't support undo, but we can just use the fallback (no-JS) editor. The experience is not very friendly (e.g. due to two-column diff), but it works. Previously we showed an old-school alert() message and then loaded the fancy editor as if it was a normal edit, ignoring the undo parameters. The whole thing is rather hypothetical, since there are no links to undo in the mobile interface. See T191706. Bug: T191706 Change-Id: I5147ada9e85d9188f19ae898fdd411985d19182f --- i18n/en.json | 1 - i18n/qqq.json | 1 - resources/skins.minerva.editor/init.js | 11 +++++------ skin.json | 1 - 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 4c61b7c31..3441a53eb 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -17,7 +17,6 @@ "mobile-frontend-editor-tutorial-confirm": "Start editing", "mobile-frontend-editor-tutorial-summary": "Try improving the $1 page.
Don't be scared of markup.", "mobile-frontend-editor-unavailable": "Mobile editing is not currently available on your browser. Please try a different browser.", - "mobile-frontend-editor-undo-unsupported": "Undo is not currently supported on mobile devices.", "mobile-frontend-editor-uploadenable": "Please upload a photo first to enable editing.", "mobile-frontend-footer-sitename": "{{SITENAME}}", "mobile-frontend-history": "View edit history of this page.", diff --git a/i18n/qqq.json b/i18n/qqq.json index 50bda07dc..25fe44490 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -26,7 +26,6 @@ "mobile-frontend-editor-tutorial-confirm": "Text for the button a user clicks after they have read the editing tutorial and are ready to edit the page.\n\nSee also:\n* {{msg-mw|Mobile-frontend-editor-tutorial-summary}}", "mobile-frontend-editor-tutorial-summary": "Text for tutorial overlay presented to a user the first time they try to edit a page.\n\nParameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Mobile-frontend-editor-tutorial-alt-summary}}", "mobile-frontend-editor-unavailable": "Message that appears when a user attempts to edit with an unsupported/incapable browser.\n\nPreceded by the header {{msg-mw|Mobile-frontend-editor-unavailable-header}}.", - "mobile-frontend-editor-undo-unsupported": "Shown when user attempts to do an undo which is currently not supported.", "mobile-frontend-editor-uploadenable": "Shown when try to edit a new file page.", "mobile-frontend-footer-sitename": "Name of site", "mobile-frontend-history": "Used as label for the link which points to the \"Edit history\" page.\n\nThis is shown on the Main Page in place of a last modified label to avoid confusion caused by transclusions.\n\nIf not the Main Page, the following message is used:\n* {{msg-mw|Mobile-frontend-last-modified-date}}", diff --git a/resources/skins.minerva.editor/init.js b/resources/skins.minerva.editor/init.js index ac1f571de..477e3c80b 100644 --- a/resources/skins.minerva.editor/init.js +++ b/resources/skins.minerva.editor/init.js @@ -166,12 +166,6 @@ isNewPage = page.options.id === 0, leadSection = page.getLeadSectionElement(); - if ( mw.util.getParamValue( 'undo' ) ) { - // TODO: Replace with an OOUI dialog - // eslint-disable-next-line no-alert - alert( mw.msg( 'mobile-frontend-editor-undo-unsupported' ) ); - } - page.$( '.edit-page, .edit-link' ).removeClass( disabledClass ) .on( 'click', onEditLinkClick ); overlayManager.add( /^\/editor\/(\d+|all)$/, function ( sectionId ) { @@ -410,6 +404,11 @@ return; } + if ( mw.util.getParamValue( 'undo' ) ) { + // Our fancy editor doesn't support undo, but we can rely on the fallback. + return; + } + if ( !isEditingSupported ) { // Editing is disabled (or browser is blacklisted) updateEditPageButton( false ); diff --git a/skin.json b/skin.json index e54d02bcc..50df76380 100644 --- a/skin.json +++ b/skin.json @@ -533,7 +533,6 @@ "mobile-frontend-editor-unavailable", "mobile-frontend-editor-uploadenable", "mobile-frontend-editor-cta", - "mobile-frontend-editor-undo-unsupported", "mobile-frontend-editor-edit", "mobile-frontend-editor-redlink-create", "mobile-frontend-editor-redlink-leave",