change of archived label should force a reload of the parents since it can change its visibility status, fixes #3422

This commit is contained in:
zadam 2022-12-14 19:26:39 +01:00
parent 223ca95829
commit c4b0c44919

View file

@ -1047,7 +1047,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const noteIdsToReload = new Set(); const noteIdsToReload = new Set();
for (const ecAttr of loadResults.getAttributes()) { for (const ecAttr of loadResults.getAttributes()) {
if (ecAttr.type === 'label' && ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'archived', 'color'].includes(ecAttr.name)) { if (ecAttr.type === 'label' && ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'color'].includes(ecAttr.name)) {
if (ecAttr.isInheritable) { if (ecAttr.isInheritable) {
noteIdsToReload.add(ecAttr.noteId); noteIdsToReload.add(ecAttr.noteId);
} }
@ -1055,6 +1055,17 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
noteIdsToUpdate.add(ecAttr.noteId); noteIdsToUpdate.add(ecAttr.noteId);
} }
} }
else if (ecAttr.type === 'label' && ecAttr.name === 'archived') {
const note = froca.getNoteFromCache(ecAttr.noteId);
if (note) {
// change of archived status can mean the note should not be displayed in the tree at all
// depending on the value of this.hideArchivedNotes
for (const parentNote of note.getParentNotes()) {
noteIdsToReload.add(parentNote.noteId);
}
}
}
else if (ecAttr.type === 'relation' && ecAttr.name === 'template') { else if (ecAttr.type === 'relation' && ecAttr.name === 'template') {
// missing handling of things inherited from template // missing handling of things inherited from template
noteIdsToReload.add(ecAttr.noteId); noteIdsToReload.add(ecAttr.noteId);