mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Merge "Tidy up DAT load failure handling"
This commit is contained in:
commit
246e2ebb4e
|
@ -395,8 +395,7 @@
|
||||||
"visualeditor-loadwarning-token",
|
"visualeditor-loadwarning-token",
|
||||||
"visualeditor-savedialog-identify-anon",
|
"visualeditor-savedialog-identify-anon",
|
||||||
"visualeditor-savedialog-identify-trylogin",
|
"visualeditor-savedialog-identify-trylogin",
|
||||||
"visualeditor-savedialog-identify-user",
|
"visualeditor-savedialog-identify-user"
|
||||||
"visualeditor-timeout"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ext.visualEditor.mobileArticleTarget": {
|
"ext.visualEditor.mobileArticleTarget": {
|
||||||
|
|
|
@ -246,10 +246,10 @@
|
||||||
"visualeditor-linknodeinspector-add-label": "Add label",
|
"visualeditor-linknodeinspector-add-label": "Add label",
|
||||||
"visualeditor-linknodeinspector-title": "Simple link",
|
"visualeditor-linknodeinspector-title": "Simple link",
|
||||||
"visualeditor-loaderror-message": "Error loading data from server: $1.",
|
"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-loaderror-title": "The editor could not load",
|
||||||
"visualeditor-loadwarning": "Error loading data from server: $1. Would you like to retry?",
|
"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-loadwarning-token": "Error loading edit token from server: $1. Would you like to retry?",
|
||||||
"visualeditor-magiclinknodeinspector-convert-link": "Convert to simple link",
|
"visualeditor-magiclinknodeinspector-convert-link": "Convert to simple link",
|
||||||
"visualeditor-magiclinknodeinspector-title-isbn": "ISBN link",
|
"visualeditor-magiclinknodeinspector-title-isbn": "ISBN link",
|
||||||
|
@ -350,7 +350,6 @@
|
||||||
"visualeditor-settings-tool": "Page settings",
|
"visualeditor-settings-tool": "Page settings",
|
||||||
"visualeditor-shortcuts-insert": "Insert",
|
"visualeditor-shortcuts-insert": "Insert",
|
||||||
"visualeditor-special-characters-group-other": "Often used",
|
"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-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": "Save page",
|
||||||
"visualeditor-toolbar-savedialog-short": "Save",
|
"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-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-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-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-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": "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}}",
|
"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
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
ve.init.mw.DesktopArticleTarget.prototype.loadFail = function ( errorText, error ) {
|
ve.init.mw.DesktopArticleTarget.prototype.loadFail = function ( errorText, error ) {
|
||||||
|
var errorInfo, confirmPromptMessage;
|
||||||
// Parent method
|
// Parent method
|
||||||
ve.init.mw.DesktopArticleTarget.super.prototype.loadFail.apply( this, arguments );
|
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' ) &&
|
||||||
Object.prototype.hasOwnProperty.call( error.error, 'info' )
|
Object.prototype.hasOwnProperty.call( error.error, 'info' )
|
||||||
) {
|
) {
|
||||||
error = error.error.info;
|
errorInfo = error.error.info;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if ( !error || error.statusText !== 'abort' ) {
|
||||||
errorText === 'http' &&
|
if ( errorText === 'http' ) {
|
||||||
( error.statusText !== 'abort' || error.xhr.status !== 504 ) &&
|
if ( error && error.xhr.status ) {
|
||||||
(
|
confirmPromptMessage = ve.msg(
|
||||||
(
|
'visualeditor-loadwarning',
|
||||||
error.xhr.status &&
|
'HTTP ' + error.xhr.status
|
||||||
confirm( ve.msg( 'visualeditor-loadwarning', 'HTTP ' + error.xhr.status ) )
|
);
|
||||||
) ||
|
} else {
|
||||||
(
|
confirmPromptMessage = ve.msg(
|
||||||
!error.xhr.status &&
|
|
||||||
confirm( ve.msg(
|
|
||||||
'visualeditor-loadwarning',
|
'visualeditor-loadwarning',
|
||||||
ve.msg( 'visualeditor-loadwarning-noconnect' )
|
ve.msg( 'visualeditor-loadwarning-noconnect' )
|
||||||
) )
|
);
|
||||||
)
|
}
|
||||||
)
|
} else if ( errorInfo ) {
|
||||||
) {
|
confirmPromptMessage = ve.msg( 'visualeditor-loadwarning', errorText + ': ' + errorInfo );
|
||||||
this.load();
|
} else {
|
||||||
} else if (
|
// At least give the devs something to work from
|
||||||
errorText === 'http' && error.xhr.status === 504 &&
|
confirmPromptMessage = JSON.stringify( error );
|
||||||
confirm( ve.msg( 'visualeditor-timeout' ) )
|
|
||||||
) {
|
|
||||||
if ( 'veaction' in this.currentUri.query ) {
|
|
||||||
delete this.currentUri.query.veaction;
|
|
||||||
}
|
}
|
||||||
this.currentUri.query.action = 'edit';
|
}
|
||||||
location.href = this.currentUri.toString();
|
|
||||||
} else if (
|
if ( confirmPromptMessage && confirm( confirmPromptMessage ) ) {
|
||||||
errorText !== 'http' &&
|
|
||||||
typeof error === 'string' &&
|
|
||||||
confirm( ve.msg( 'visualeditor-loadwarning', errorText + ': ' + error ) )
|
|
||||||
) {
|
|
||||||
this.load();
|
this.load();
|
||||||
} else {
|
} 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 );
|
this.deactivate( true );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue