jenkins-bot has submitted this change and it was merged.

Change subject: Tidy up DAT load failure handling
......................................................................


Tidy up DAT load failure handling

Get rid of the 504 Gateway Timeout handling while we're here, in preparation
for bug T135748 where that kind of thing will be made normal.

Change-Id: Ia4abb1a68ff7ab7ff365c7348bf4d2ad35c43a27
---
M extension.json
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
4 files changed, 24 insertions(+), 39 deletions(-)

Approvals:
  Krinkle: Looks good to me, but someone else must approve
  Siebrand: Looks good to me, but someone else must approve
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 4a3db75..a17fb61 100644
--- a/extension.json
+++ b/extension.json
@@ -394,8 +394,7 @@
                                "visualeditor-loadwarning-token",
                                "visualeditor-savedialog-identify-anon",
                                "visualeditor-savedialog-identify-trylogin",
-                               "visualeditor-savedialog-identify-user",
-                               "visualeditor-timeout"
+                               "visualeditor-savedialog-identify-user"
                        ]
                },
                "ext.visualEditor.mobileArticleTarget": {
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index f58cb81..5784f89 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -244,10 +244,10 @@
        "visualeditor-linknodeinspector-add-label": "Add label",
        "visualeditor-linknodeinspector-title": "Simple link",
        "visualeditor-loaderror-message": "Error loading data from server: $1.",
-       "visualeditor-loaderror-message-noconnect": "Could not connect to the 
server.",
+       "visualeditor-loaderror-message-noconnect": "Could not connect to the 
server",
        "visualeditor-loaderror-title": "The editor could not load",
        "visualeditor-loadwarning": "Error loading data from server: $1. Would 
you like to retry?",
-       "visualeditor-loadwarning-noconnect": "Could not connect",
+       "visualeditor-loadwarning-noconnect": "Could not connect to the server",
        "visualeditor-loadwarning-token": "Error loading edit token from 
server: $1. Would you like to retry?",
        "visualeditor-magiclinknodeinspector-convert-link": "Convert to simple 
link",
        "visualeditor-magiclinknodeinspector-title-isbn": "ISBN link",
@@ -348,7 +348,6 @@
        "visualeditor-settings-tool": "Page settings",
        "visualeditor-shortcuts-insert": "Insert",
        "visualeditor-special-characters-group-other": "Often used",
-       "visualeditor-timeout":"It looks like this editor is currently 
unavailable. Would you like to edit in source mode instead?",
        "visualeditor-toload": "The editor will now load. If you still see this 
message after a few seconds, please [$1 reload the page].",
        "visualeditor-toolbar-savedialog": "Save page",
        "visualeditor-toolbar-savedialog-short": "Save",
diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json
index d56f9f7..2b61ff6 100644
--- a/modules/ve-mw/i18n/qqq.json
+++ b/modules/ve-mw/i18n/qqq.json
@@ -360,7 +360,6 @@
        "visualeditor-settings-tool": "Text of tool in the toolbar the lets 
users set specific page settings.\n{{Identical|Page settings}}",
        "visualeditor-shortcuts-insert": "Heading for insertion 
shortcuts\n{{Identical|Insert}}",
        "visualeditor-special-characters-group-other": "Label of the special 
character group shown if the wiki has visualeditor-quick-access-characters.json 
set up.",
-       "visualeditor-timeout": "Text (JavaScript confirm()) shown when the 
editor fails to load properly due to a 504 Gateway Timeout error.",
        "visualeditor-toload": "Text shown to the user in place of the wikitext 
editor on action=edit/submit when VisualEditor is expected to 
load.\n\nParameters\n* $1 is the URL which points to a page with a fallback to 
the wikitext editor if necessary.",
        "visualeditor-toolbar-savedialog": "Label text for button to open save 
dialog.\n\nUsed in:\n* 
{{msg-mw|Guidedtour-tour-gettingstartedtasktoolbarve-click-save-description}}.\n{{Identical|Save
 page}}",
        "visualeditor-toolbar-savedialog-short": "Short label text for button 
to open save dialog on width-restricted devices\n{{Identical|Save}}",
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index fe47c30..42d910f 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -661,6 +661,7 @@
  * @inheritdoc
  */
 ve.init.mw.DesktopArticleTarget.prototype.loadFail = function ( errorText, 
error ) {
+       var errorInfo, confirmPromptMessage;
        // Parent method
        ve.init.mw.DesktopArticleTarget.super.prototype.loadFail.apply( this, 
arguments );
 
@@ -671,46 +672,33 @@
                Object.prototype.hasOwnProperty.call( error, 'error' ) &&
                Object.prototype.hasOwnProperty.call( error.error, 'info' )
        ) {
-               error = error.error.info;
+               errorInfo = error.error.info;
        }
 
-       if (
-               errorText === 'http' &&
-               ( error.statusText !== 'abort' || error.xhr.status !== 504 ) &&
-               (
-                       (
-                               error.xhr.status &&
-                               confirm( ve.msg( 'visualeditor-loadwarning', 
'HTTP ' + error.xhr.status ) )
-                       ) ||
-                       (
-                               !error.xhr.status &&
-                               confirm( ve.msg(
+       if ( !error || error.statusText !== 'abort' ) {
+               if ( errorText === 'http' ) {
+                       if ( error && error.xhr.status ) {
+                               confirmPromptMessage = ve.msg(
+                                       'visualeditor-loadwarning',
+                                       'HTTP ' + error.xhr.status
+                               );
+                       } else {
+                               confirmPromptMessage = ve.msg(
                                        'visualeditor-loadwarning',
                                        ve.msg( 
'visualeditor-loadwarning-noconnect' )
-                               ) )
-                       )
-               )
-       ) {
-               this.load();
-       } else if (
-               errorText === 'http' && error.xhr.status === 504 &&
-               confirm( ve.msg( 'visualeditor-timeout' ) )
-       ) {
-               if ( 'veaction' in this.currentUri.query ) {
-                       delete this.currentUri.query.veaction;
+                               );
+                       }
+               } else if ( errorInfo ) {
+                       confirmPromptMessage = ve.msg( 
'visualeditor-loadwarning', errorText + ': ' + errorInfo );
+               } else {
+                       // At least give the devs something to work from
+                       confirmPromptMessage = JSON.stringify( error );
                }
-               this.currentUri.query.action = 'edit';
-               location.href = this.currentUri.toString();
-       } else if (
-               errorText !== 'http' &&
-               typeof error === 'string' &&
-               confirm( ve.msg( 'visualeditor-loadwarning', errorText + ': ' + 
error ) )
-       ) {
+       }
+
+       if ( confirmPromptMessage && confirm( confirmPromptMessage ) ) {
                this.load();
        } else {
-               // Something weird happened? Deactivate
-               // Not passing trackMechanism because we don't know what 
happened
-               // and this is not a user action
                this.deactivate( true );
        }
 };

-- 
To view, visit https://gerrit.wikimedia.org/r/314456
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4abb1a68ff7ab7ff365c7348bf4d2ad35c43a27
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to