mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 16:34:21 +00:00
Merge "ReplyWidget: Double-check that we can post before posting"
This commit is contained in:
commit
85472b7e31
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue