Skip to content

Commit

Permalink
Properly handle metadata inheritance for non uploaded nodes in edit m…
Browse files Browse the repository at this point in the history
…odal.
  • Loading branch information
rtibbles committed Sep 27, 2024
1 parent 6f6daf2 commit 5827048
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,17 @@
return newNodeId;
});
},
resetInheritMetadataModal() {
this.$refs.inheritModal?.checkInheritance();
},
createTopic() {
this.createNode('topic', {
title: '',
}).then(newNodeId => {
this.selected = [newNodeId];
this.$nextTick(() => {
this.resetInheritMetadataModal();
});
});
},
async createNodesFromUploads(fileUploads) {
Expand Down Expand Up @@ -569,7 +575,7 @@
})
);
this.creatingNodes = false;
this.$refs.inheritModal?.resetClosed();
this.resetInheritMetadataModal();
},
updateTitleForPage() {
this.updateTabTitle(this.$store.getters.appendChannelName(this.modalTitle));
Expand All @@ -580,8 +586,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,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;
Expand Down Expand Up @@ -242,14 +255,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();
});
});
}
Expand Down

0 comments on commit 5827048

Please sign in to comment.