mirror of
https://github.com/zadam/trilium.git
synced 2024-09-21 08:06:03 +08:00
delete preview takes into account strong/weak branches
This commit is contained in:
parent
b6f7c604c7
commit
5a2907b670
|
@ -413,7 +413,7 @@ export default class TabManager extends Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recentlyClosedTabs.push(noteContexts);console.log(this.recentlyClosedTabs);
|
this.recentlyClosedTabs.push(noteContexts);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabReorderEvent({ntxIdsInOrder}) {
|
tabReorderEvent({ntxIdsInOrder}) {
|
||||||
|
|
|
@ -235,15 +235,19 @@ function getDeleteNotesPreview(req) {
|
||||||
const {branchIdsToDelete, deleteAllClones} = req.body;
|
const {branchIdsToDelete, deleteAllClones} = req.body;
|
||||||
|
|
||||||
const noteIdsToBeDeleted = new Set();
|
const noteIdsToBeDeleted = new Set();
|
||||||
const branchCountToDelete = {}; // noteId => count (integer)
|
const strongBranchCountToDelete = {}; // noteId => count (integer)
|
||||||
|
|
||||||
function branchPreviewDeletion(branch) {
|
function branchPreviewDeletion(branch) {
|
||||||
branchCountToDelete[branch.branchId] = branchCountToDelete[branch.branchId] || 0;
|
if (branch.isWeak) {
|
||||||
branchCountToDelete[branch.branchId]++;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
strongBranchCountToDelete[branch.branchId] = strongBranchCountToDelete[branch.branchId] || 0;
|
||||||
|
strongBranchCountToDelete[branch.branchId]++;
|
||||||
|
|
||||||
const note = branch.getNote();
|
const note = branch.getNote();
|
||||||
|
|
||||||
if (deleteAllClones || note.getParentBranches().length <= branchCountToDelete[branch.branchId]) {
|
if (deleteAllClones || note.getStrongParentBranches().length <= strongBranchCountToDelete[branch.branchId]) {
|
||||||
noteIdsToBeDeleted.add(note.noteId);
|
noteIdsToBeDeleted.add(note.noteId);
|
||||||
|
|
||||||
for (const childBranch of note.getChildBranches()) {
|
for (const childBranch of note.getChildBranches()) {
|
||||||
|
|
Loading…
Reference in a new issue