From a6ce1e23a7213003cd7e8ccf2bfbeebd7edf1e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 19 Mar 2020 01:03:09 +0100 Subject: [PATCH] ReplyWidget: Double-check that we can post before posting Bug: T246058 Change-Id: Ic87b062c2fd6d7f48933a94e140ce392003ee65a --- modules/dt.ui.ReplyWidget.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/dt.ui.ReplyWidget.js b/modules/dt.ui.ReplyWidget.js index e04455585..ad87fa529 100644 --- a/modules/dt.ui.ReplyWidget.js +++ b/modules/dt.ui.ReplyWidget.js @@ -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 ); @@ -276,6 +278,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(); }