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
This commit is contained in:
Bartosz Dziewoński 2018-09-21 00:40:51 +02:00 committed by Jdlrobson
parent ffa4d0e848
commit b6672a4f9f
4 changed files with 5 additions and 9 deletions

View File

@ -17,7 +17,6 @@
"mobile-frontend-editor-tutorial-confirm": "Start editing",
"mobile-frontend-editor-tutorial-summary": "Try improving the $1 page.<br />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.",

View File

@ -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}}",

View File

@ -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 );

View File

@ -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",