From f304600a744787ee01ceaa136c0fc5073a7d9e90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sun, 20 Jan 2019 19:38:21 +0100 Subject: [PATCH] Remove errors on upload See #2825 --- .../files/js/WoltLabSuite/Core/Ui/File/Upload.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/File/Upload.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/File/Upload.js index fae2649eac..25743c85da 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/File/Upload.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/File/Upload.js @@ -122,6 +122,13 @@ define(['Core', 'Language', 'Dom/Util', 'WoltLabSuite/Core/Ui/File/Delete', 'Upl throw new Error("Upload failed: " + data.message); }, + _upload: function(event, file, blob) { + var innerError = elBySel('small.innerError:not(.innerFileError)', this._buttonContainer.parentNode); + if (innerError) elRemove(innerError); + + return Upload._super.prototype._upload.call(this, event, file, blob); + }, + _success: function(uploadId, data, responseText, xhr, requestOptions) { for (var i in this._fileElements[uploadId]) { if (data['files'][i] !== undefined) { @@ -199,7 +206,9 @@ define(['Core', 'Language', 'Dom/Util', 'WoltLabSuite/Core/Ui/File/Delete', 'Upl DomUtil.insertAfter(innerError, this._buttonContainer); } - innerError.textContent = WCF.Language.get('wcf.upload.error.reachedRemainingLimit').replace(/#remaining#/, this._options.maxFiles); + innerError.textContent = Language.get('wcf.upload.error.reachedRemainingLimit', { + maxFiles: this._options.maxFiles - this.countFiles() + }); return false; } -- 2.20.1