From 00286a89a99b8a7ecc98af6c845fa6bc3f2acf75 Mon Sep 17 00:00:00 2001 From: buddh4 Date: Mon, 8 Oct 2018 21:59:02 +0200 Subject: [PATCH] Fix: Comment form files not cleared --- protected/humhub/docs/CHANGELOG.md | 1 + .../content/resources/js/humhub.content.form.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md index bd49ff60b9..3cb0b02a70 100644 --- a/protected/humhub/docs/CHANGELOG.md +++ b/protected/humhub/docs/CHANGELOG.md @@ -15,6 +15,7 @@ HumHub Change Log - Enh: Enable `data-action-keypress` by default - Enh: Added `preventDefault` argument to `humhub.modules.action.bindAction` to disable prevent default behaviour for action events - Fix: Fix bootstrap-datepicker.en.min.js 404 (Not Found) +- Fix: Comment form files not cleared 1.3.4 (September 25, 2018) diff --git a/protected/humhub/modules/content/resources/js/humhub.content.form.js b/protected/humhub/modules/content/resources/js/humhub.content.form.js index 50867408e0..2a8a7828a1 100644 --- a/protected/humhub/modules/content/resources/js/humhub.content.form.js +++ b/protected/humhub/modules/content/resources/js/humhub.content.form.js @@ -82,6 +82,7 @@ humhub.module('content.form', function(module, require, $) { this.resetSettingInputs(); this.setDefaultVisibility(); this.resetFilePreview(); + this.resetFileUpload(); $('#public').attr('checked', false); $('#contentFormBody').find('.humhub-ui-richtext').trigger('clear'); @@ -95,7 +96,17 @@ humhub.module('content.form', function(module, require, $) { }; CreateForm.prototype.resetFilePreview = function() { - Widget.instance($('#contentFormFiles_preview')).reset(); + var preview = Widget.instance($('#contentFormFiles_preview')); + if(preview) { + preview.reset(); + } + }; + + CreateForm.prototype.resetFileUpload = function() { + var upload = Widget.instance($('#contentForm_message-file-upload')); + if(upload) { + upload.reset(); + } }; CreateForm.prototype.handleError = function(response) {