mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
Merge "Tidy up DAT load failure handling"
This commit is contained in:
commit
246e2ebb4e
|
@ -395,8 +395,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": {
|
||||
|
|
|
@ -246,10 +246,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",
|
||||
|
@ -350,7 +350,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",
|
||||
|
|
|
@ -363,7 +363,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}}",
|
||||
|
|
|
@ -661,6 +661,7 @@ ve.init.mw.DesktopArticleTarget.prototype.cancel = function ( trackMechanism ) {
|
|||
* @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 @@ ve.init.mw.DesktopArticleTarget.prototype.loadFail = function ( errorText, error
|
|||
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 );
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue