From 3fff4b9db0cc178e65908e7d4c10b51835e18428 Mon Sep 17 00:00:00 2001 From: Ron Lucke <lucke@elan-ev.de> Date: Mon, 18 Mar 2024 14:42:56 +0000 Subject: [PATCH] fix #3830 Closes #3830 Merge request studip/studip!2699 --- .../CoursewareStructuralElement.vue | 21 ++++++++++++------- .../courseware/toolbar/CoursewareToolbar.vue | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/resources/vue/components/courseware/structural-element/CoursewareStructuralElement.vue b/resources/vue/components/courseware/structural-element/CoursewareStructuralElement.vue index 10b884b1ef1..6ad1ec34b60 100644 --- a/resources/vue/components/courseware/structural-element/CoursewareStructuralElement.vue +++ b/resources/vue/components/courseware/structural-element/CoursewareStructuralElement.vue @@ -780,7 +780,8 @@ export default { displayFeedback: false, showRatingPopup: false, - ratingPopupFeedbackElement: null + ratingPopupFeedbackElement: null, + storing: false, }; }, @@ -1452,11 +1453,13 @@ export default { }), initCurrent() { - this.currentElement = _.cloneDeep(this.structuralElement); - this.uploadFileError = ''; - this.deletingPreviewImage = false; - this.uploadImageURL = null; - this.loadFeedback(); + if (!this.storing) { + this.currentElement = _.cloneDeep(this.structuralElement); + this.uploadFileError = ''; + this.deletingPreviewImage = false; + this.uploadImageURL = null; + this.loadFeedback(); + } }, async menuAction(action) { switch (action) { @@ -1559,6 +1562,7 @@ export default { } }, async storeCurrentElement() { + this.storing = true; await this.loadStructuralElement(this.currentElement.id); if (this.blockedByAnotherUser) { this.companionWarning({ @@ -1568,6 +1572,7 @@ export default { ) }); this.showElementEditDialog(false); + this.storing = false; return false; } if (!this.blocked) { @@ -1598,7 +1603,6 @@ export default { } this.showElementEditDialog(false); - if (this.currentElement.attributes['release-date'] !== '') { this.currentElement.attributes['release-date'] = new Date(this.currentElement.attributes['release-date']).getTime() / 1000; @@ -1618,6 +1622,7 @@ export default { await this.updateStructuralElement({ element, id: this.currentId}); await this.unlockObject({ id: this.currentId, type: 'courseware-structural-elements' }); this.$emit('select', this.currentId); + this.storing = false; this.initCurrent(); }, @@ -1977,7 +1982,7 @@ export default { this.loadProgresses(); } - if (this.inCourse) { + if (this.inCourse && this.hasFeedbackElement) { this.loadFeedbackElement({ id: this.feedbackElementId }); } }, diff --git a/resources/vue/components/courseware/toolbar/CoursewareToolbar.vue b/resources/vue/components/courseware/toolbar/CoursewareToolbar.vue index 0a56b5c902a..7a49363f33d 100644 --- a/resources/vue/components/courseware/toolbar/CoursewareToolbar.vue +++ b/resources/vue/components/courseware/toolbar/CoursewareToolbar.vue @@ -163,7 +163,7 @@ export default { watch: { containers(oldValue, newValue) { - if (newValue && oldValue.length !== newValue.length) { + if (oldValue && newValue && oldValue.length !== newValue.length) { this.resetAdderStorage(); } }, -- GitLab