mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
Merge "Don't send API requests to preview empty (or whitespace-only) edit summaries"
This commit is contained in:
commit
82e979ef87
|
@ -179,22 +179,28 @@ ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel ) {
|
|||
this.editSummaryXhr.abort();
|
||||
}
|
||||
this.lastEditSummaryWikitext = currentEditSummaryWikitext;
|
||||
this.$reviewEditSummary.empty()
|
||||
.parent().show().addClass( 'mw-ajax-loader' );
|
||||
this.editSummaryXhr = new mw.Api().post( {
|
||||
action: 'parse',
|
||||
summary: currentEditSummaryWikitext
|
||||
} ).done( function ( result ) {
|
||||
if ( result.parse.parsedsummary['*'] === '' ) {
|
||||
this.$reviewEditSummary.empty();
|
||||
|
||||
if ( !currentEditSummaryWikitext || currentEditSummaryWikitext.trim() === '' ) {
|
||||
// Don't bother with an API request for an empty summary
|
||||
this.$reviewEditSummary.parent().hide();
|
||||
} else {
|
||||
this.$reviewEditSummary.parent().show().addClass( 'mw-ajax-loader' );
|
||||
this.editSummaryXhr = new mw.Api().post( {
|
||||
action: 'parse',
|
||||
summary: currentEditSummaryWikitext
|
||||
} ).done( function ( result ) {
|
||||
if ( result.parse.parsedsummary['*'] === '' ) {
|
||||
dialog.$reviewEditSummary.parent().hide();
|
||||
} else {
|
||||
dialog.$reviewEditSummary.html( ve.msg( 'parentheses', result.parse.parsedsummary['*'] ) );
|
||||
}
|
||||
} ).fail( function () {
|
||||
dialog.$reviewEditSummary.parent().hide();
|
||||
} else {
|
||||
dialog.$reviewEditSummary.html( ve.msg( 'parentheses', result.parse.parsedsummary['*'] ) );
|
||||
}
|
||||
} ).fail( function () {
|
||||
dialog.$reviewEditSummary.parent().hide();
|
||||
} ).always( function () {
|
||||
dialog.$reviewEditSummary.parent().removeClass( 'mw-ajax-loader' );
|
||||
} );
|
||||
} ).always( function () {
|
||||
dialog.$reviewEditSummary.parent().removeClass( 'mw-ajax-loader' );
|
||||
} );
|
||||
}
|
||||
}
|
||||
/* falls through */
|
||||
case 'nochanges':
|
||||
|
|
Loading…
Reference in a new issue