mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
ReplyWidget: Handle save errors
Bug: T240519 Depends-On: Ie18666b41f4aff1ab4bcf93f9df6e3000ac7b500 Depends-On: I2a731cb273401074e65f9283c1f629dbdb272002 Change-Id: Ice92fafb1f546510dab28e3f8aa7d2280668965a
This commit is contained in:
parent
0a88c0fbba
commit
6d243ed74a
|
@ -90,14 +90,18 @@ ReplyWidget.prototype.createReplyBodyWidget = null;
|
|||
|
||||
ReplyWidget.prototype.focus = null;
|
||||
|
||||
ReplyWidget.prototype.clear = null;
|
||||
|
||||
ReplyWidget.prototype.insertNewNodes = null;
|
||||
|
||||
ReplyWidget.prototype.getValue = null;
|
||||
|
||||
ReplyWidget.prototype.isEmpty = null;
|
||||
|
||||
ReplyWidget.prototype.clear = function () {
|
||||
if ( this.errorMessage ) {
|
||||
this.errorMessage.$element.remove();
|
||||
}
|
||||
};
|
||||
|
||||
ReplyWidget.prototype.setPending = function ( pending ) {
|
||||
if ( pending ) {
|
||||
this.replyButton.setDisabled( true );
|
||||
|
@ -234,6 +238,10 @@ ReplyWidget.prototype.onReplyClick = function () {
|
|||
var repliedTo,
|
||||
widget = this;
|
||||
|
||||
if ( this.errorMessage ) {
|
||||
this.errorMessage.$element.remove();
|
||||
}
|
||||
|
||||
this.setPending( true );
|
||||
|
||||
this.comment.parsoidPromise.then( function ( parsoidData ) {
|
||||
|
@ -262,6 +270,12 @@ ReplyWidget.prototype.onReplyClick = function () {
|
|||
repliedTo: repliedTo
|
||||
} );
|
||||
mw.hook( 'wikipage.content' ).fire( $container );
|
||||
}, function ( code, data ) {
|
||||
widget.errorMessage = new OO.ui.MessageWidget( {
|
||||
type: 'error',
|
||||
label: ( new mw.Api() ).getErrorMessage( data )
|
||||
} );
|
||||
widget.errorMessage.$element.insertBefore( widget.replyBodyWidget.$element );
|
||||
} ).always( function () {
|
||||
widget.setPending( false );
|
||||
} );
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
margin-left: -1.6em;
|
||||
}
|
||||
|
||||
&-anonWarning {
|
||||
.oo-ui-messageWidget {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@ ReplyWidgetPlain.prototype.focus = function () {
|
|||
};
|
||||
|
||||
ReplyWidgetPlain.prototype.clear = function () {
|
||||
// Parent method
|
||||
ReplyWidgetPlain.super.prototype.clear.apply( this, arguments );
|
||||
|
||||
this.replyBodyWidget.setValue( '' );
|
||||
};
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ ReplyWidgetVisual.prototype.getValue = function () {
|
|||
};
|
||||
|
||||
ReplyWidgetVisual.prototype.clear = function () {
|
||||
// Parent method
|
||||
ReplyWidgetVisual.super.prototype.clear.apply( this, arguments );
|
||||
|
||||
this.replyBodyWidget.clear();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue