itemTree: handle restoring child item from trash in notify (#4796)

If a child item is restored from the trash and its parent row
exists and is open, collapse the parent row and expand it
to re-render child items.

Fixes: #4791
This commit is contained in:
abaevbog 2024-11-22 03:41:55 -08:00 committed by GitHub
parent 56ae6d9793
commit f824741d07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -705,6 +705,16 @@ var ItemTree = class ItemTree extends LibraryTree {
sort = id;
}
}
// If a trashed child item is restored while its parent's row is expanded,
// collapse and re-open the parent to have that child item row added.
else {
let parentItemRowIndex = this.getRowIndexByID(item.parentItemID);
if (parentItemRowIndex === false) continue;
if (this.isContainerOpen(parentItemRowIndex)) {
this.toggleOpenState(parentItemRowIndex, true);
await this.toggleOpenState(parentItemRowIndex);
}
}
}
if (sort && ids.length != 1) {