Warn for empty summary when edit section used

Warn the user about an empty edit summary when the "edit section"
link is used to trigger VE.

Re-does Ic7b456ca a different way.

Bug: T114857
Change-Id: I319c9c5bed47140a81eb409d490c9f82b89a49fe
This commit is contained in:
wctaiwan 2016-02-21 03:35:05 -05:00 committed by Alex Monk
parent cbb7831938
commit 5da37932a2
3 changed files with 4 additions and 3 deletions

View file

@ -927,7 +927,6 @@ ve.init.mw.DesktopArticleTarget.prototype.openSaveDialog = function () {
checkboxFields: this.checkboxFields,
checkboxesByName: this.checkboxesByName
} );
this.initialEditSummary = undefined;
};
/**

View file

@ -1195,7 +1195,7 @@ ve.init.mw.ArticleTarget.prototype.startSave = function ( saveDeferred ) {
if (
+mw.user.options.get( 'forceeditsummary' ) &&
saveOptions.summary === '' &&
( saveOptions.summary === '' || saveOptions.summary === this.initialEditSummary ) &&
!this.saveDialog.messages.missingsummary
) {
this.saveDialog.showMessage(

View file

@ -28,6 +28,7 @@ ve.ui.MWSaveDialog = function VeUiMwSaveDialog( config ) {
this.setupDeferred = $.Deferred();
this.target = null;
this.checkboxesByName = null;
this.changedEditSummary = false;
// Initialization
this.$element.addClass( 've-ui-mwSaveDialog' );
@ -382,6 +383,7 @@ ve.ui.MWSaveDialog.prototype.initialize = function () {
// Limit byte length, and display the remaining bytes
this.editSummaryInput.$input.byteLimit( this.editSummaryByteLimit );
this.editSummaryInput.on( 'change', function () {
dialog.changedEditSummary = true;
// TODO: This looks a bit weird, there is no unit in the UI, just numbers
// Users likely assume characters but then it seems to count down quicker
// than expected. Facing users with the word "byte" is bad? (bug 40035)
@ -480,7 +482,7 @@ ve.ui.MWSaveDialog.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWSaveDialog.super.prototype.getSetupProcess.call( this, data )
.next( function () {
this.target = data.target;
if ( data.editSummary !== undefined ) {
if ( !this.changedEditSummary ) {
this.setEditSummary( data.editSummary );
}
this.setupCheckboxes( data.checkboxFields || [] );