From: Alexander Ebert Date: Wed, 12 Jun 2013 14:16:04 +0000 (+0200) Subject: Added check for pending saves to prevent duplicate entries X-Git-Tag: 2.0.0_Beta_4~56^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fae5ea60a34b1b39d15f6ca3b71dadf78b08a65e;p=GitHub%2FWoltLab%2FWCF.git Added check for pending saves to prevent duplicate entries --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index cab388b1df..4e3f2febfe 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -608,6 +608,12 @@ WCF.Message.QuickReply = Class.extend({ */ _notification: null, + /** + * true, if a request to save the message is pending + * @var boolean + */ + _pendingSave: false, + /** * action proxy * @var WCF.Action.Proxy @@ -641,6 +647,7 @@ WCF.Message.QuickReply = Class.extend({ init: function(supportExtendedForm, quoteManager) { this._container = $('#messageQuickReply'); this._messageField = $('#text'); + this._pendingSave = false; if (!this._container || !this._messageField) { return; } @@ -743,6 +750,10 @@ WCF.Message.QuickReply = Class.extend({ * Saves message. */ _save: function() { + if (this._pendingSave) { + return; + } + var $message = ''; if ($.browser.mobile) { @@ -767,6 +778,8 @@ WCF.Message.QuickReply = Class.extend({ $innerError.remove(); } + this._pendingSave = true; + this._proxy.setOption('data', { actionName: 'quickReply', className: this._getClassName(), @@ -846,6 +859,8 @@ WCF.Message.QuickReply = Class.extend({ * Prepares jump to extended message add form. */ _prepareExtended: function() { + this._pendingSave = true; + // mark quotes for removal if (this._quoteManager !== null) { this._quoteManager.markQuotesForRemoval(); @@ -925,6 +940,8 @@ WCF.Message.QuickReply = Class.extend({ if (this._quoteManager !== null) { this._quoteManager.countQuotes(); } + + this._pendingSave = false; } }, @@ -932,6 +949,7 @@ WCF.Message.QuickReply = Class.extend({ * Reverts quick reply on failure to preserve entered message. */ _failure: function(data) { + this._pendingSave = false; this._revertQuickReply(false); if (data === null || data.returnValues === undefined || data.returnValues.errorType === undefined) {