Merge "ReplyWidget: Double-check that we can post before posting"

This commit is contained in:
jenkins-bot 2020-03-20 19:37:48 +00:00 committed by Gerrit Code Review
commit 85472b7e31

View file

@ -20,6 +20,7 @@ function ReplyWidget( comment, config ) {
// Parent constructor
ReplyWidget.super.call( this, config );
this.pending = false;
this.comment = comment;
contextNode = utils.closestElement( this.comment.range.endContainer, [ 'dl', 'ul', 'ol' ] );
this.context = contextNode ? contextNode.nodeName.toLowerCase() : 'dl';
@ -116,6 +117,7 @@ ReplyWidget.prototype.clear = function () {
};
ReplyWidget.prototype.setPending = function ( pending ) {
this.pending = pending;
if ( pending ) {
this.replyButton.setDisabled( true );
this.cancelButton.setDisabled( true );
@ -277,6 +279,10 @@ ReplyWidget.prototype.onUnload = function () {
ReplyWidget.prototype.onReplyClick = function () {
var widget = this;
if ( this.pending || this.isEmpty() ) {
return;
}
if ( this.errorMessage ) {
this.errorMessage.$element.remove();
}