diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue index 3e74a3a986..3ab92e6cbb 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue @@ -534,15 +534,22 @@ return newNodeId; }); }, + resetInheritMetadataModal() { + this.$refs.inheritModal?.checkInheritance(); + }, createTopic() { this.createNode('topic', { title: '', }).then(newNodeId => { this.selected = [newNodeId]; + this.$nextTick(() => { + this.resetInheritMetadataModal(); + }); }); }, async createNodesFromUploads(fileUploads) { this.creatingNodes = true; + const parentPropDefinedForInheritModal = Boolean(this.$refs.inheritModal?.parent); this.newNodeIds = await Promise.all( fileUploads.map(async (file, index) => { let title; @@ -569,7 +576,11 @@ }) ); this.creatingNodes = false; - this.$refs.inheritModal?.resetClosed(); + if (parentPropDefinedForInheritModal) { + // Only call this if the parent prop was previously defined, otherwise, + // rely on the parent prop watcher to trigger the inherit event. + this.resetInheritMetadataModal(); + } }, updateTitleForPage() { this.updateTabTitle(this.$store.getters.appendChannelName(this.modalTitle)); @@ -580,8 +591,13 @@ }); }, inheritMetadata(metadata) { + if (!this.createMode) { + // This shouldn't happen, but prevent this just in case. + return; + } const setMetadata = () => { - for (const nodeId of this.newNodeIds) { + const nodeIds = this.uploadMode ? this.newNodeIds : this.selected; + for (const nodeId of nodeIds) { this.updateContentNode({ id: nodeId, ...metadata, diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue index b43deb5a4d..333d3f0eab 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/InheritAncestorMetadataModal.vue @@ -111,12 +111,7 @@ ); }, active() { - return ( - this.parent !== null && - !this.allFieldsDesignatedByParent && - !this.closed && - this.parentHasInheritableMetadata - ); + return this.parent !== null && !this.closed; }, inheritableMetadataItems() { const returnValue = {}; @@ -192,6 +187,19 @@ }, methods: { ...mapActions('contentNode', ['updateContentNode']), + /** + * @public + */ + checkInheritance() { + if (this.allFieldsDesignatedByParent || !this.parentHasInheritableMetadata) { + // If all fields have been designated by the parent, or there is nothing to inherit, + // automatically continue + this.handleContinue(); + } else { + // Wait for the data to be updated before showing the dialog + this.closed = false; + } + }, resetData() { if (this.parent) { this.dontShowAgain = false; @@ -242,14 +250,7 @@ }; }, {}); this.$nextTick(() => { - if (this.allFieldsDesignatedByParent || !this.parentHasInheritableMetadata) { - // If all fields have been designated by the parent, or there is nothing to inherit, - // automatically continue - this.handleContinue(); - } else { - // Wait for the data to be updated before showing the dialog - this.closed = false; - } + this.checkInheritance(); }); }); } @@ -299,12 +300,6 @@ this.closed = true; this.$emit('inherit', {}); }, - /** - * @public - */ - resetClosed() { - this.closed = false; - }, }, $trs: { applyResourceDetailsTitle: "Apply details from the folder '{folder}'", diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/CurrentTopicView.vue b/contentcuration/contentcuration/frontend/channelEdit/views/CurrentTopicView.vue index 84f387da38..a994e1c9aa 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/CurrentTopicView.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/CurrentTopicView.vue @@ -931,12 +931,6 @@ this.updateContentNode({ id: nodeId, ...metadata, mergeMapFields: true }); } this.CLEAR_INHERITING_NODES(nodeIds); - this.$nextTick(() => { - // Once the inheritance is complete, reset the modal closed state. - if (!this.inheritingNodes || this.inheritingNodes.length === 0) { - this.$refs.inheritModal?.resetClosed(); - } - }); }, }, $trs: {